Contacts

RSS for tag

Access the user's contacts and format and localize contact information using Contacts.

Contacts Documentation

Posts under Contacts tag

46 Posts
Sort by:
Post not yet marked as solved
2 Replies
473 Views
On our backend we detected imported contacts with strange identifiers, that looks like CNSuggestedContactStore://YnBsaXN0MDDUAQIDBAUGBwpYJHZlc...AAA. Inside of base64 encoded strictly service information like $archiver, CF$UID, internalEntityId, SGRecordId, $classname. I think that contact identifier always should be in uuid format isn't it? Do somebody know what this contacts are and how to obtain them for debug?
Posted
by ntyunin.
Last updated
.
Post not yet marked as solved
0 Replies
408 Views
The documentation for hightlightProperty(withKey:identifier:) describes the parameter "key" as the "Key of the property to highlight." I believe that refers to the CNKeyDescriptor, such as CNContactGivenNameKey, which can cast from a type CNKeyDescriptor to String. The documentation for identifier is "the value to highlight". I believe an example of that would be "John" as the given name. Am I correct about all this? In any case, I'm not able to highlight an email property when I use CNContactEmailAddresses as the key, and an actual email address as the identifier. I have also tried using the identifier property of CNLabeledValue, which is how an email address is stored. I can't find anything on the internet to explain this. I didn't even find a similar question, except my own question asking this exact same question about two months ago. Anyone have any idea or a good answer for this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
387 Views
The application I am creating is using CNContact() and I am trying to attach an Instagram profile. There currently is no CNSocialProfileService for Instagram. Does anyone know of a way to do so? Currently I have: let socialProfile = CNLabeledValue(label: social.service, value: CNSocialProfile(urlString: "https://www.instagram.com/" + social.username, username: social.username, userIdentifier: nil, service: "Instagram")) That works but when it saves to contacts it creates a Custom Service and then capitalizes the service name and the username.
Posted Last updated
.
Post not yet marked as solved
0 Replies
626 Views
After presenting a CNContactViewController to create a new contact once I open the image editor and instead of going through the whole flow I decide the cancel it once I get back to my contact VC the cancel and done buttons are gone and I have no way to dismiss the contact info. Note: If you do go through setting an image at the end of the flow once you are back to the contacts VC the buttons are enabled again and the VC can be dismissed. Here's a quick code example of the presentation logic. This is all this app did. class ViewController: UIViewController { let button = UIButton(primaryAction: UIAction(handler: { _ in self.presentContacts() })) func presentContacts() { let mutableContact = CNMutableContact() let newPhone = CNLabeledValue(label: CNLabelPhoneNumberMobile, value: CNPhoneNumber(stringValue: "randomnumberhere")) mutableContact.phoneNumbers += [newPhone] let cont = CNContactViewController(forUnknownContact: mutableContact) cont.contactStore = CNContactStore() cont.allowsActions = false cont.isEditing = true cont.delegate = self let nav = UINavigationController(rootViewController: cont) nav.modalPresentationStyle = .fullScreen let navBarAppearance = UINavigationBarAppearance() navBarAppearance.configureWithTransparentBackground() nav.navigationBar.standardAppearance = navBarAppearance nav.navigationBar.scrollEdgeAppearance = navBarAppearance self.navigationController?.present(cont, animated: true) } } extension ViewController: CNContactViewControllerDelegate { func contactViewController(_ viewController: CNContactViewController, shouldPerformDefaultActionFor property: CNContactProperty) -> Bool { return false } func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) { viewController.dismiss(animated: true) } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
416 Views
Is your feature request related to a problem? Please describe. Everywhere where Apple offers it, I use Apple's Private Relay e-mail addresses. However, they can't be manually generated, so for the rest, I use https://anonaddy.me. Because it offers infinite aliases, I use a different alias every time I give my e-mail address to someone. However, I ensure that they're all under the @rokejulianlockhart.anonaddy.com (.com and .me are equivalent in this case) domain so that they can be identified as me by a human. I use different aliases to combat spam, not be anonymous. Additionally, when messaging others, I ensure that I add a sub-address with my name to their e-mail address so that they can filter all messages from me (even if I'm using a different alias for my own filtering purposes). Others use the same when communicating with me, especially family. The current identification system doesn't take sub-addresses into account whatsoever. Describe the solution you'd like I should therefore be able to set RY7I0I+RY7I0R@rokejulianlockhart.anonaddy.com as an e-mail address, and beneath it add, for instance [A-Za-z0-9]+\+[A-Za-z0-9]+@rokejulianlockhart\.anonaddy\.com in another input form to ensure that Nextcloud identifies any (in this case sub-addressed) alias as me. Describe alternatives you've considered The sole current alternative is to list literal tens of thousands of aliases as myself, which is insane. It also wouldn't work, because https://anonaddy.me generates a new alias when someone else uses one, so I'd have to retroactively add those whenever someone else uses one. It also wouldn't account for sub-addresses. Additional context Like most more powerful features of Nextcloud, this only need be visible when clicked on. Adding a button beside each e-mail address to show a form which allows the user to enter custom regex is enough. Additionally requested at: https://feedbackportal.microsoft.com/feedback/idea/ed4261f8-af28-ee11-a81c-6045bd8534ad. https://discussions.apple.com/thread/255016441. https://github.com/nextcloud/contacts/issues/3530#issue-1816825315.
Posted Last updated
.
Post not yet marked as solved
1 Replies
388 Views
Hi, i have around 1600 contacts on my iphone but only 350 of them are in the icloud. how can i add them all. I got a new phone and only the 350 contacts transferred.
Posted
by Etree022.
Last updated
.
Post not yet marked as solved
6 Replies
4.0k Views
Hi,I saw the WWDC talk on the new Contacts framework, and I had a couple of questions about the identifier property:When users upgrade from iOS8 to iOS9, will their old AddressBook recordIDs still work if we are using the AddressBook framework in the app (i.e. haven't upgraded to using Contacts framework)?Are the new CNContact identifiers consistent across iOS and Mac devices? i.e. if we have the identifier on one device, we can lookup the contact on another device with the same identifier?Can these identifiers change in the lifetime of that contact? This was a problem with AddressBook recordIDs ... if you removed the account and then synced it back again, all the contacts would get a different identifier. Same with restoring the device. Will the CNGroup and CNContainer identifiers also be consistent across devices?Hope someone in the Apple Contacts frameworks team can answer. Thanks.
Posted
by zulfishah.
Last updated
.
Post not yet marked as solved
0 Replies
414 Views
On my iPhone, in Settings, I've added my company Exchange account. Consequently, within the Contacts app, 4 new lists appear - the bottom as shown in the attached image. There's a few thousand contacts in the Company Exchange account, so why are the count values showing as 0? If I click on the Global Address list and search, it can succfully find whatever I search for. I want to programatically retrieve the contacts within the Exchange account, in addition to those stored locally or within iCloud, however if I execute the following code, for the container of type exchange, the count of results of the call to unifiedContacts() is 0. How can I programatically get the Exchange contacts? If the call to unifiedContacts() is resulting in 0 because the count for the lists when viewing the Contacts app is 0, then how to make it not 0 in the Contacts app (but if that were the case, how come manually searching for a contact is successful?) let keysToFetch = [ CNContactFormatter.descriptorForRequiredKeys(for: .fullName), CNContactPhoneNumbersKey, CNContactEmailAddressesKey, CNContactThumbnailImageDataKey] as [Any] var allContainers: [CNContainer] = [] do { allContainers = try CNContactStore().containers(matching: nil) } catch { print("Error fetching containers") } var results: [CNContact] = [] for container in allContainers { let type = container.type let identifier = container.identifier let fetchPredicate = CNContact.predicateForContactsInContainer(withIdentifier: container.identifier) do { let containerResults = try CNContactStore().unifiedContacts(matching: fetchPredicate, keysToFetch: keysToFetch as! [CNKeyDescriptor]) let count = containerResults.count results.append(contentsOf: containerResults) } catch { print("Error fetching containers") } }
Posted
by mungbeans.
Last updated
.
Post not yet marked as solved
0 Replies
708 Views
Hi, we are using following setting in our web app to capture customer contact/shipping details: we have selected "detailed request" from "Apple pay payment request" It leads to parsing of following data: However, we do not need the **postal address, ** just email and contact is enough. The problem is in many cases users have not added a shipping address to their apple account, which leads to this screen in case they try to pay: Is it possible to just ask users for "contact number" and "email address" and EXCLUDE asking shipping address which they might have not added, so the payment goes through even if the user has not updated the "address".
Posted Last updated
.
Post not yet marked as solved
0 Replies
798 Views
Why did I get an error in playground in debug window for this code? print("// MARK: - Start execable code here...") do { let store = CNContactStore() if try await store.requestAccess(for: .contacts) { // Do something with Contacts. let phoneNumber = CNPhoneNumber(stringValue: "903-276-1046") let predicateForContactsMatchingPhoneNumber = CNContact.predicateForContacts(matching: phoneNumber) let contactFetchRequest = CNContactFetchRequest(keysToFetch: thoroughKeysToCompare) contactFetchRequest.predicate = predicateForContactsMatchingPhoneNumber contactFetchRequest.unifyResults = true var contactOfMe: CNContact! = nil try! store.enumerateContacts(with: contactFetchRequest) { contact, stop in contactOfMe = contact stop.pointee = true } let contact = Contact(cnContact: contactOfMe) for property in contact.enumerated() { print("- \(property)") } } else { // Handle if Contacts access is denied. fatalError() } } catch { // Handle any error. print("error requesting access: \(error.localizedDescription)") } Debug window: // MARK: - Start execable code here... Playground execution failed: error: Execution was interrupted, reason: shared-library-event. The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation. * thread #1, queue = 'com.apple.main-thread' frame #0: 0x00007ff80002f931 libobjc.A.dylib`_mapStrHash(_NXMapTable*, void const*) + 73 frame #1: 0x00007ff80002fc7f libobjc.A.dylib`_NXMapMember(_NXMapTable*, void const*, void**) + 35 frame #2: 0x00007ff80003b7ae libobjc.A.dylib`getProtocol(char const*) + 41 frame #3: 0x00007ff8000428e6 libobjc.A.dylib`class_conformsToProtocol + 337 frame #4: 0x00007ff80004ab4e libobjc.A.dylib`-[NSObject conformsToProtocol:] + 47 frame #5: 0x0000000109c27951 UIKitCore`_UIFocusItemContainerIsScrollableContainer + 74 frame #6: 0x0000000109c28e38 UIKitCore`-[_UIFocusEnvironmentContainerTuple initWithOwningEnvironment:itemContainer:] + 194 frame #7: 0x0000000109c28fed UIKitCore`+[_UIFocusEnvironmentContainerTuple tupleWithOwningEnvironment:itemContainer:] + 70 frame #8: 0x0000000109c4f41e UIKitCore`_UIFocusRegionContainerFromEnvironmentAndContainer + 44 frame #9: 0x0000000109c27ed3 UIKitCore`_UIFocusItemContainerAddChildItemsInContextWithArguments + 1162 frame #10: 0x000000010a99c439 UIKitCore`-[UIView _searchForFocusRegionsInContext:] + 962 frame #11: 0x0000000109c6b37f UIKitCore`-[_UIFocusMapSnapshot addRegionsInContainer:] + 4583 frame #12: 0x0000000109c69740 UIKitCore`-[_UIFocusMapSnapshot _capture] + 456 frame #13: 0x0000000109c67fc5 UIKitCore`-[_UIFocusMapSnapshot _initWithSnapshotter:mapArea:searchArea:] + 628 frame #14: 0x0000000109c6cce2 UIKitCore`-[_UIFocusMapSnapshotter captureSnapshot] + 227 frame #15: 0x0000000109c5f450 UIKitCore`-[_UIFocusMap _inferredDefaultFocusItemInEnvironment:] + 147 frame #16: 0x0000000109c2b1cf UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerationContext _inferPreferencesForEnvironment:] + 157 frame #17: 0x0000000109c2abbc UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerationContext _resolvePreferredFocusEnvironments] + 118 frame #18: 0x0000000109c2ab12 UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerationContext prefersNothingFocused] + 31 frame #19: 0x0000000109c2beeb UIKitCore`_enumeratePreferredFocusEnvironments + 198 frame #20: 0x0000000109c2c061 UIKitCore`_enumeratePreferredFocusEnvironments + 572 frame #21: 0x0000000109c2c061 UIKitCore`_enumeratePreferredFocusEnvironments + 572 frame #22: 0x0000000109c2c061 UIKitCore`_enumeratePreferredFocusEnvironments + 572 frame #23: 0x0000000109c2bd11 UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerator enumeratePreferencesForEnvironment:usingBlock:] + 230 frame #24: 0x0000000109c2c747 UIKitCore`-[_UIDeepestPreferredEnvironmentSearch deepestPreferredFocusableItemForEnvironment:withRequest:] + 817 frame #25: 0x0000000109c95837 UIKitCore`-[UIFocusUpdateContext _updateDestinationItemIfNeeded] + 265 frame #26: 0x0000000109c95627 UIKitCore`-[UIFocusUpdateContext _destinationItemInfo] + 22 frame #27: 0x0000000109c95535 UIKitCore`-[UIFocusUpdateContext nextFocusedItem] + 24 frame #28: 0x0000000109c71ea6 UIKitCore`-[UIFocusSystem updateFocusIfNeeded] + 1347 frame #29: 0x0000000109c7608c UIKitCore`__43-[UIFocusSystem _updateFocusUpdateThrottle]_block_invoke + 34 frame #30: 0x000000010a94b971 UIKitCore`-[_UIAfterCACommitBlock run] + 57 frame #31: 0x000000010a94be71 UIKitCore`-[_UIAfterCACommitQueue flush] + 191 frame #32: 0x000000010a3926eb UIKitCore`_runAfterCACommitDeferredBlocks + 782 frame #33: 0x000000010a380fa2 UIKitCore`_cleanUpAfterCAFlushAndRunDeferredBlocks + 96 frame #34: 0x000000010a3b6be1 UIKitCore`_afterCACommitHandler + 58 frame #35: 0x00007ff8003b1c12 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 frame #36: 0x00007ff8003ac57f CoreFoundation`__CFRunLoopDoObservers + 515 frame #37: 0x00007ff8003acaa2 CoreFoundation`__CFRunLoopRun + 1121 frame #38: 0x00007ff8003ac264 CoreFoundation`CFRunLoopRunSpecific + 560 frame #39: 0x00007ff8003ad234 CoreFoundation`CFRunLoopRun + 40 frame #40: 0x00007ff83755a4e3 libswift_Concurrency.dylib`swift_task_asyncMainDrainQueueImpl() + 35 frame #41: 0x00007ff83755a4b4 libswift_Concurrency.dylib`swift_task_asyncMainDrainQueue + 52 frame #42: 0x00000001015d409f $__lldb_expr32`main at <unknown>:0 frame #43: 0x0000000100e25560 EnumeratedContactsCNContact`linkResources + 256 frame #44: 0x00007ff8003b2986 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 frame #45: 0x00007ff8003b2148 CoreFoundation`__CFRunLoopDoBlocks + 399 frame #46: 0x00007ff8003ace09 CoreFoundation`__CFRunLoopRun + 1992 frame #47: 0x00007ff8003ac264 CoreFoundation`CFRunLoopRunSpecific + 560 frame #48: 0x00007ff809b4024e GraphicsServices`GSEventRunModal + 139 frame #49: 0x000000010a3827bf UIKitCore`-[UIApplication _run] + 994 frame #50: 0x000000010a3875de UIKitCore`UIApplicationMain + 123 * frame #51: 0x0000000100e256c5 EnumeratedContactsCNContact`main + 357 frame #52: 0x0000000100fbb384 dyld_sim`start_sim + 10 frame #53: 0x000000010943341f dyld`start + 1903```
Posted Last updated
.
Post not yet marked as solved
0 Replies
439 Views
Hi, Im using the CNContactStore.currentHistory (available from iOS 13) to get token and check version of contacts. Everything is good til I try it on iOS 13 and iOS 14. Token is always nil from both ObjC and Swift. Is it a bug? Or have any way to handle that instead? Have any way to get token in iOS 13, 14? Any help would be greatly appreciated. Thank you!
Posted Last updated
.
Post not yet marked as solved
0 Replies
655 Views
If I have located (or created) a CNContact record on one device (e.g., iPhone), and I want to retrieve that same record programmatically from another device (e.g., iPad or Mac), is there any unique id that identifies that record? The identifier property on CNContact seems to be assigned for the local replica of the contact record, but I don't believe it can be used to retrieve the record on another device (e.g., using unifiedContact(withIdentifier...). I can unifiedContact(matching...) but not guaranteed to get same record if there are multiples with same predicate property values. I'm pretty new to Swift and CNContactStore, so sorry if I'm missing something obvious.
Posted
by dlshap.
Last updated
.
Post not yet marked as solved
0 Replies
760 Views
You can programatically get/set a picture and a thumbnail for a contact, however the new poster field added to iOS 17 apparently has no programatic access? I'm not able to see anything new being added to CNContact.h
Posted
by mungbeans.
Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
We are developing an app that will show contact information - name, phone numbers, email addresses, and physical addresses. When I prepare screen shots and 30 second videos for the Apple App Store listing, for privacy, I want to avoid showing contact information from my own personal contacts.  I understand that someone (maybe an Apple engineer) developed a vCard file with 60 iPhone Demo Contacts with "John Appleseed" and others. Does anyone know how I can obtain a zip file for those Demo Contacts, or something similar, in English? I understand the vCard file with 60 contacts was previously, but no longer, available for download as a 5.2 MB zip file on TUAW.
Posted Last updated
.
Post not yet marked as solved
0 Replies
520 Views
In the WWDC, there was a mention of the CallKit framework that it would be possible for 3rd party VoIP apps to create Posters programmatically. However, there are no new methods around this in the CallKit framework. Are we missing something?
Posted
by knakul.
Last updated
.