Contacts

RSS for tag

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

Posts under Contacts tag

194 Posts

Post

Replies

Boosts

Views

Activity

Determining whether a vCard has a duplicate on a current iOS device?
What criteria does Apple use to determine whether a vCard sent for example as an email attachment has a duplicate? I would think there has to be more in common between the duplicates than just the given name and the family name? Does Apple say whether the given name, family name, and address enough similarities to consider two contacts duplicates of each other?
1
0
600
Jun ’22
Contacts API Silent Failures
We’ve been attempting to reliably update contacts in iCloud and Gmail containers. Having tried several approaches (bulk writes, batched writes, one-by-one writes with sleeps in between, etc.), we’ve found flakiness in all approaches that is never exposed to the app. Diving a little deeper, we’ve found that this appears to be due to internal server-client failures between iOS and the relevant CardDAV servers. From our analysis, we seem to be seeing 2 key types of failure: When the client-server interaction is interrupted, contact update requests appear to be discarded and not resumed for whichever container was currently in progress. After a variable period of time, the server wipes the newer client state and reverts to an older, stale state. We’re trying to understand if there is something we are doing wrong with our writes or if this is an iOS level bug. This is easily reproducible for any device connected to an iCloud or Gmail account with circa. 100+ contacts: for each container for each contact in container create CNSaveRequest update any field in contact and add to save request execute save request
0
5
852
Jun ’22
How do I update CloudKit whenever there is a change in Contacts in iOS?
Is there any way to run code in iOS whenever new information are added to certain contacts in contact store? If I use Notifications, I would have to have a process running at all times, since contacts are able to be changed by Apple's Contacts app. I have looked at App Extensions and there are no extensions I that can be used. There is a way to run a background process but I recall that has a limited lifespan. Am I correct about this? I need to update data in CloudKit that saves contacts information that can be shared with other users using their own Apple ID's. CloudKit subscriptions notify my app when something changes in CloudKit, but I also need to update records in CloudKit when something changes in Contacts. Anyone have any ideas how this might possibly be done?
2
0
1.1k
Jun ’22
Contacts: Filter birthdays not containing year
Using: selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) Code compiles but contact still shows. How to select the correct data element from the contacts birthday when it doesn’t contain a year? func contactPicker(_ picker: CNContactPickerViewController, didSelect contacts: [CNContact]) { //selectedContacts = contacts.filter ({ $0.birthday?.value(for: .year) != nil }) selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) //value(for: .year) != nil })
1
0
597
May ’22
How do I convert an struct of type Data to an object of type CNGroup?
I'm having trouble converting a CNGroup object to a Data object and back to a CNGroup object. I decided to start rethinking the problem again. Somewhere along the way I decided that I should use the Data class to save a CNGroup object to CloudKit. I also learned that the field type to use in my CKRecord object would be of the type bytes. Am I correct so far? I am able to convert a CNGroup object to a Data object and back again unless I store the Data object in CloudKit and then retrieve it before I convert the Data object back to a CNGroup object, in which case I get an error when I try to access the pointee property of the typed pointer. That would be an UnsafeBufferPointer, an UnsafeMutableBufferPointer, or an UnsafePointer. I've tried a lot of different code using different ways. It is impractical to put so much code in my post. I have used the copyBytes method and the withUnsafeBytes method of the Data object. There is one simple code, and that is when I converted the CNGroup object to a Data object: func convertCNGroupToData(fromCNGroup group: inout CNGroup) -> Data { return Data(bytes: &group, count: MemoryLayout.size(ofValue: group)) } I am looking for a simple way to do what I want. I am relooking at Apple's documentation of Data and NSData. I am not able to be more specific with this question. I appreciate any effort to help me with this.
1
0
611
Apr ’22
CNContactPickerView for macOS project ?
Hello, Xcode 12 here. AddressBook labelled as deprecated but still present in Xcode 12 / Big Sur and my macOS app works fine on it. This is an app made in Obj-C that I sell on the Mac App Store since 2013, which I modernized progressively once in a while. I now want to modernize it even more and replace AddressBook with Contacts to get rid of everything labelled as deprecated. In the Xcode objects list though, I can't find the CNContactPickerView to replace the old ABPeoplePickerView, although I linked the new Contacts framework to my project. The doc says it's available in iOS and Mac Catalyst. Does it mean it won't be available for a genuine macOS project ? If this is the case, how can I proceed, or should I just keep using AddressBook as long as it works ? In this case, for how long will Apple allow developers to use it ? Thank you.
1
0
1.3k
Apr ’22
Contacts Framework CNFetchResult
Anyone ever use CNFetchResult successfully? I find nothing on the internet, on stackoverflow, and in Apple Developer Forums. The only thing I have found is Apple Documentation for it. It says CNFetchResult is a Generic Class. What exactly does that mean. I found an explanation that gives its definition, but the rest of the explanation is very long winded.
10
0
1.5k
Mar ’22
iOS Contacts Framework Change History Data using Swift and Xcode 13
On Apple's documentation of the Contacts Framework for iOS and Swift on their developer website, there is a section called Change History Data. It consists of a list of classes and one protocol. The protocol seems to be the most important item of the list - the CNChangeHistoryEventVisitor protocol. The protocol apparently has instance methods each of which use one of those classes listed. Where do I find documentation to use this protocol and these classes? Anyone ever use these before? Here's the list: class CNChangeHistoryAddContactEvent class CNChangeHistoryAddGroupEvent class CNChangeHistoryAddMemberToGroupEvent class CNChangeHistoryAddSubgroupToGroupEvent class CNChangeHistoryDeleteContactEvent class CNChangeHistoryDeleteGroupEvent class CNChangeHistoryDropEverythingEvent class CNChangeHistoryEvent class CNChangeHistoryFetchRequest class CNChangeHistoryRemoveMemberFromGroupEvent class CNChangeHistoryRemoveSubgroupFromGroupEvent class CNChangeHistoryUpdateContactEvent class CNChangeHistoryUpdateGroupEvent protocol CNChangeHistoryEventVisitor
3
0
1.8k
Mar ’22
What to use instead of the deprecated ABAddressBookRegisterExternalChangeCallback(::_:) function?
I found information about the ABAddressBookRegisterExternalChangeCallback(::_:) function of the Address Book Framework, but that function has been deprecated, and only works with iOS 2.0–9.0. I don't see a function in the Contacts Framework that does what that function does. Is there some way that the Contacts Framework could do something that this function provided a solution for?
1
0
1.1k
Mar ’22
Contact Note Field Access Entitlement Location?
Hello Everyone, I requested for the Contact Note Field Access Entitlement here : https://developer.apple.com/contact/request/contact-note-field It was Approved I created a new provisioning profile and I can see that I have got the access for Notes filed, in the provisioning profile details. But when I try to fetch all Notes field it gives me error : Unauthorized Keys Can someone please tell me where is the Entitlement file location ? Or do I have to create one ? Apple told me to wait 2 to 3 days and it will appear in my Account, but they did not specify the exact location? Where in the account do I have to look for it?
3
0
2.0k
Mar ’22
How do I run code in the background in iOS that will always run?
Is there a way to put code in iOS that is always watching in the background for the contact store to change? If I put it in my app, then the user can close the app, and the app won't receive notifications when the contact store changes? Is there an app extension I can use that would allow me to do this, whether that is the intent of the extension or not?
1
0
2.2k
Mar ’22
Why this error in xcode? "Provisioning profile "MyApp_Distribution" doesn't include the com.apple.developer.contacts.notes entitlement."
I had requested for Contact Note Field Access Entitlement (via https://developer.apple.com/contact/request/contact-note-field) and got it enabled in app id's additional capabilities section. I have created app store distribution provisioning profile using this app id. And also added "com.apple.developer.contacts.notes YES" in entitlements file. But I'm getting the below error in xcode. I'm not able to archive the build because of this. How can I resolve this issue?
2
0
1.4k
Mar ’22
How would I store information in a CNContact object that the contact store would keep as persistent data?
I need to be able to identify a CNContact so as to associate it with a CKRecord in a iCloud private database. If I use a non-unified contact, would the identifier be unique across all existing iOS devices so that I could store the identifier property in a record in the user's iCloud private database to identify a specific contact? The documentation says that the identifier of a CNContact stored object is unique within the device. If I use a UUID value and store it in the iCloud private database to identify the specific contact, how would I match that with the contact? I would need to save that UUID value as part of the contact object as stored in the contact store. Is that possible without saving the UUID value in the notes property of the contact. It would be better if I could store the UUID value somewhere where the user could not access it and delete or edit it. Is there a way to make the notes property of a contact inaccessible to the user where even if he/she could see it, he would not be able to change it? I'm not very familiar with the hash and hashValue properties of NSObject object. Though unlikely, would one of those properties be able to identify a contact uniquely across all existing iOS devices so that I could store it in the user's iCloud private database in order to associate a certain record in that database with a specific contact?
0
0
564
Mar ’22
iOS app crashes when asking the permission for contact framework
This is how I request contacts framework access permission -(void)askUserToAccessContacts {   @try   {     if([CNContactStore class])     {       //iOS 9 or later       CNEntityType entityType = CNEntityTypeContacts;       if( [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined)       {         CNContactStore * contactStore = [[CNContactStore alloc] init];         [contactStore requestAccessForEntityType:entityType completionHandler:^(BOOL granted, NSError * _Nullable error) {           if(granted){             DDLogVerbose(@"Permission granted for Contacts access...");           }         }];       }       else if( [CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized)       {         DDLogVerbose(@"Permission granted for Contacts access !!!");       }       else       {         DDLogVerbose(@"Permission not granted for Contacts access !!!");       }     }         } @catch (NSException *exception) {           [[WriteLogger getWriteLogger] writeLog:@"AppDelegate" sourceClass:NSStringFromClass([self class]) methodName:NSStringFromSelector(_cmd) exception:exception exceptionDict:nil];   } } What could possibly cause the app to crash? By the way, this crash is not occurring all the time, it happens randomly when I install the app and launch it for the first time. Incident Identifier: 33DC6088-0DC6-40A1-91E5-F7A76E3154EB Hardware Model: iPhone12,8 Version: 21.10.0 (0.5.2) AppStoreTools: 13C90b AppVariant: 1:iPhone12,8:15 Beta: YES Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Date/Time: 2022-01-10 11:43:38.9707 +0530 Launch Time: 2022-01-10 11:43:17.9333 +0530 OS Version: iPhone OS 15.1 (19B74) Release Type: User Baseband Version: 3.00.00 Report Version: 104 Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Kernel Triage: VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage Thread 0 name: Thread 0 Crashed: 0 libsystem_kernel.dylib 0x00000001b73d0504 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x00000001b73d0b9c mach_msg + 76 (mach_msg.c:119) 2 libdispatch.dylib 0x000000018019127c _dispatch_mach_send_and_wait_for_reply + 520 (mach.c:815) 3 libdispatch.dylib 0x000000018019162c dispatch_mach_send_with_result_and_wait_for_reply + 56 (mach.c:2019) 4 libxpc.dylib 0x00000001f083eb9c xpc_connection_send_message_with_reply_sync + 240 (connection.c:974) 5 TCC 0x00000001e78bb0c0 tccd_send_message + 940 (TCC.c:490) 6 TCC 0x00000001e78c0e08 __TCCAccessRequest_block_invoke.213 + 876 (TCC.c:591) 7 libdispatch.dylib 0x0000000180176660 _dispatch_client_callout + 20 (object.m:560) 8 libdispatch.dylib 0x00000001801858b4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:1016) 9 libsystem_trace.dylib 0x000000019ac86668 _os_activity_initiate_impl + 64 (activity.c:131) 10 TCC 0x00000001e78bc4e0 TCCAccessRequest + 476 (TCC.c:1019) 11 TCC 0x00000001e78ba8b8 TCCAccessRestricted + 228 (TCC.c:1682) 12 ContactsFoundation 0x000000018ce4a6ec -[CNTCCVersion2 isAuthorizationRestricted] + 96 (CNTCCVersion2.m:79) 13 ContactsFoundation 0x000000018ce034a4 -[CNAuthorizationContext isAccessRestricted] + 52 (CNAuthorizationContext.m:90) 14 Contacts 0x0000000185c42b04 +[CNAuthorization isAccessRestrictedForEntityType:] + 72 (CNAuthorization.m:26) 15 Contacts 0x0000000185c5ba30 +[CNAuthorization authorizationStatusForEntityType:] + 40 (CNAuthorization.m:66) 16 ios_app 0x00000001024bc724 -[MainAppDelegate askUserToAccessContacts] + 84 (MainAppDelegate.m:1338) 17 ios_app 0x00000001024b61b8 -[MainAppDelegate application:didFinishLaunchingWithOptions:] + 1520 (MainAppDelegate.m:228) log.crash
0
0
1.5k
Feb ’22
[iOS 15] Match INPerson with CNContact for incoming INStartCallIntent
I'm trying to break through focus mode in my app that receives VOIP notifications. I've added a particular contact to the "allowlist" for a particular focus mode. When I receive a call from my app, I create an INStartCallIntent. To create the INPerson, I use an INPersonHandle with the value being the identifier that I fetch from the contact. There are also 2 other identifier fields in INPerson that are both nullable (contactIdentifier and customIdentifier). I've also tried populating those with the fetched contact's identifier. Here's my general prototyped code (yes I know this is all hard coded, but it's just a prototype for now).      INPersonHandle *handle = [[INPersonHandle alloc] initWithValue:identifier type:INPersonHandleTypeUnknown];     INPerson *caller = [[INPerson alloc] initWithPersonHandle:handle                           nameComponents:nameComponents                            displayName:name                               image:nil                         contactIdentifier:identifier                          customIdentifier:nil                        isContactSuggestion:NO                           suggestionType:INPersonSuggestionTypeSocialProfile];     NSDate *_Nonnull dateCreated = [NSDate date];     INCallRecord *const callRecord = [[INCallRecord alloc] initWithIdentifier:callId                                    dateCreated:dateCreated                                   callRecordType:INCallRecordTypeRinging                                   callCapability:callCapability                                    callDuration:nil                                       unseen:nil                                    participants:@[caller]                                   numberOfCalls:@(1)                                 isCallerIdBlocked:nil];     INStartCallIntent *const intent = [[INStartCallIntent alloc] initWithCallRecordFilter:nil                                      callRecordToCallBack:callRecord                                           audioRoute:INCallAudioRouteSpeakerphoneAudioRoute                                        destinationType:INCallDestinationTypeNormal                                            contacts:@[caller]                                         callCapability:callCapability];     // Donate the interaction to Siri     INInteraction *const interaction = [[INInteraction alloc] initWithIntent:intent response:nil];     interaction.direction = INInteractionDirectionIncoming;     [interaction donateInteractionWithCompletion:nil]; Nothing I've tried yet has been able to break through focus mode and I think it's because the identifiers aren't matching up. Apple seems to have a clear way to match contacts for email address and phone number identifiers, but it's unclear how they match based on an unknown type for the INPersonHandleType.
0
0
817
Dec ’21
How do I write code to run when the contact store was changed by another app, but not run when the contact store was changed by my app?
I noticed that when my app changes the contact store, the CNContactStoreDidChange notification fires in my app. How do I check if the notification fired because my app changed it. Is there a way to know which app made the change to the contact store. I need to know so I can write code to run only if the contact store was changed by another app instead of my app.
1
0
764
Dec ’21
Determining whether a vCard has a duplicate on a current iOS device?
What criteria does Apple use to determine whether a vCard sent for example as an email attachment has a duplicate? I would think there has to be more in common between the duplicates than just the given name and the family name? Does Apple say whether the given name, family name, and address enough similarities to consider two contacts duplicates of each other?
Replies
1
Boosts
0
Views
600
Activity
Jun ’22
Contacts API Silent Failures
We’ve been attempting to reliably update contacts in iCloud and Gmail containers. Having tried several approaches (bulk writes, batched writes, one-by-one writes with sleeps in between, etc.), we’ve found flakiness in all approaches that is never exposed to the app. Diving a little deeper, we’ve found that this appears to be due to internal server-client failures between iOS and the relevant CardDAV servers. From our analysis, we seem to be seeing 2 key types of failure: When the client-server interaction is interrupted, contact update requests appear to be discarded and not resumed for whichever container was currently in progress. After a variable period of time, the server wipes the newer client state and reverts to an older, stale state. We’re trying to understand if there is something we are doing wrong with our writes or if this is an iOS level bug. This is easily reproducible for any device connected to an iCloud or Gmail account with circa. 100+ contacts: for each container for each contact in container create CNSaveRequest update any field in contact and add to save request execute save request
Replies
0
Boosts
5
Views
852
Activity
Jun ’22
How do I update CloudKit whenever there is a change in Contacts in iOS?
Is there any way to run code in iOS whenever new information are added to certain contacts in contact store? If I use Notifications, I would have to have a process running at all times, since contacts are able to be changed by Apple's Contacts app. I have looked at App Extensions and there are no extensions I that can be used. There is a way to run a background process but I recall that has a limited lifespan. Am I correct about this? I need to update data in CloudKit that saves contacts information that can be shared with other users using their own Apple ID's. CloudKit subscriptions notify my app when something changes in CloudKit, but I also need to update records in CloudKit when something changes in Contacts. Anyone have any ideas how this might possibly be done?
Replies
2
Boosts
0
Views
1.1k
Activity
Jun ’22
What does CNContactStoreDidChange notification notify multiple times for a single change my app makes itself?
What does CNContactStoreDidChange notification notify multiple times for a single change my app makes itself?
Replies
0
Boosts
0
Views
615
Activity
Jun ’22
Set the ringtone for a contact programmatically
Is it possible in the SDK to set the ringtone for a contact without using the ContactUI?Thanks
Replies
1
Boosts
0
Views
885
Activity
May ’22
Contacts: Filter birthdays not containing year
Using: selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) Code compiles but contact still shows. How to select the correct data element from the contacts birthday when it doesn’t contain a year? func contactPicker(_ picker: CNContactPickerViewController, didSelect contacts: [CNContact]) { //selectedContacts = contacts.filter ({ $0.birthday?.value(for: .year) != nil }) selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) //value(for: .year) != nil })
Replies
1
Boosts
0
Views
597
Activity
May ’22
How do I convert an struct of type Data to an object of type CNGroup?
I'm having trouble converting a CNGroup object to a Data object and back to a CNGroup object. I decided to start rethinking the problem again. Somewhere along the way I decided that I should use the Data class to save a CNGroup object to CloudKit. I also learned that the field type to use in my CKRecord object would be of the type bytes. Am I correct so far? I am able to convert a CNGroup object to a Data object and back again unless I store the Data object in CloudKit and then retrieve it before I convert the Data object back to a CNGroup object, in which case I get an error when I try to access the pointee property of the typed pointer. That would be an UnsafeBufferPointer, an UnsafeMutableBufferPointer, or an UnsafePointer. I've tried a lot of different code using different ways. It is impractical to put so much code in my post. I have used the copyBytes method and the withUnsafeBytes method of the Data object. There is one simple code, and that is when I converted the CNGroup object to a Data object: func convertCNGroupToData(fromCNGroup group: inout CNGroup) -> Data { return Data(bytes: &group, count: MemoryLayout.size(ofValue: group)) } I am looking for a simple way to do what I want. I am relooking at Apple's documentation of Data and NSData. I am not able to be more specific with this question. I appreciate any effort to help me with this.
Replies
1
Boosts
0
Views
611
Activity
Apr ’22
CNContactPickerView for macOS project ?
Hello, Xcode 12 here. AddressBook labelled as deprecated but still present in Xcode 12 / Big Sur and my macOS app works fine on it. This is an app made in Obj-C that I sell on the Mac App Store since 2013, which I modernized progressively once in a while. I now want to modernize it even more and replace AddressBook with Contacts to get rid of everything labelled as deprecated. In the Xcode objects list though, I can't find the CNContactPickerView to replace the old ABPeoplePickerView, although I linked the new Contacts framework to my project. The doc says it's available in iOS and Mac Catalyst. Does it mean it won't be available for a genuine macOS project ? If this is the case, how can I proceed, or should I just keep using AddressBook as long as it works ? In this case, for how long will Apple allow developers to use it ? Thank you.
Replies
1
Boosts
0
Views
1.3k
Activity
Apr ’22
CNContacts framework and SmartGroups
Could someone please clarify how to access SmartGroups using the CNContacts framework?
Replies
2
Boosts
0
Views
1.2k
Activity
Mar ’22
Contacts Framework CNFetchResult
Anyone ever use CNFetchResult successfully? I find nothing on the internet, on stackoverflow, and in Apple Developer Forums. The only thing I have found is Apple Documentation for it. It says CNFetchResult is a Generic Class. What exactly does that mean. I found an explanation that gives its definition, but the rest of the explanation is very long winded.
Replies
10
Boosts
0
Views
1.5k
Activity
Mar ’22
iOS Contacts Framework Change History Data using Swift and Xcode 13
On Apple's documentation of the Contacts Framework for iOS and Swift on their developer website, there is a section called Change History Data. It consists of a list of classes and one protocol. The protocol seems to be the most important item of the list - the CNChangeHistoryEventVisitor protocol. The protocol apparently has instance methods each of which use one of those classes listed. Where do I find documentation to use this protocol and these classes? Anyone ever use these before? Here's the list: class CNChangeHistoryAddContactEvent class CNChangeHistoryAddGroupEvent class CNChangeHistoryAddMemberToGroupEvent class CNChangeHistoryAddSubgroupToGroupEvent class CNChangeHistoryDeleteContactEvent class CNChangeHistoryDeleteGroupEvent class CNChangeHistoryDropEverythingEvent class CNChangeHistoryEvent class CNChangeHistoryFetchRequest class CNChangeHistoryRemoveMemberFromGroupEvent class CNChangeHistoryRemoveSubgroupFromGroupEvent class CNChangeHistoryUpdateContactEvent class CNChangeHistoryUpdateGroupEvent protocol CNChangeHistoryEventVisitor
Replies
3
Boosts
0
Views
1.8k
Activity
Mar ’22
What to use instead of the deprecated ABAddressBookRegisterExternalChangeCallback(::_:) function?
I found information about the ABAddressBookRegisterExternalChangeCallback(::_:) function of the Address Book Framework, but that function has been deprecated, and only works with iOS 2.0–9.0. I don't see a function in the Contacts Framework that does what that function does. Is there some way that the Contacts Framework could do something that this function provided a solution for?
Replies
1
Boosts
0
Views
1.1k
Activity
Mar ’22
Contact Note Field Access Entitlement Location?
Hello Everyone, I requested for the Contact Note Field Access Entitlement here : https://developer.apple.com/contact/request/contact-note-field It was Approved I created a new provisioning profile and I can see that I have got the access for Notes filed, in the provisioning profile details. But when I try to fetch all Notes field it gives me error : Unauthorized Keys Can someone please tell me where is the Entitlement file location ? Or do I have to create one ? Apple told me to wait 2 to 3 days and it will appear in my Account, but they did not specify the exact location? Where in the account do I have to look for it?
Replies
3
Boosts
0
Views
2.0k
Activity
Mar ’22
How do I run code in the background in iOS that will always run?
Is there a way to put code in iOS that is always watching in the background for the contact store to change? If I put it in my app, then the user can close the app, and the app won't receive notifications when the contact store changes? Is there an app extension I can use that would allow me to do this, whether that is the intent of the extension or not?
Replies
1
Boosts
0
Views
2.2k
Activity
Mar ’22
Why this error in xcode? "Provisioning profile "MyApp_Distribution" doesn't include the com.apple.developer.contacts.notes entitlement."
I had requested for Contact Note Field Access Entitlement (via https://developer.apple.com/contact/request/contact-note-field) and got it enabled in app id's additional capabilities section. I have created app store distribution provisioning profile using this app id. And also added "com.apple.developer.contacts.notes YES" in entitlements file. But I'm getting the below error in xcode. I'm not able to archive the build because of this. How can I resolve this issue?
Replies
2
Boosts
0
Views
1.4k
Activity
Mar ’22
How would I store information in a CNContact object that the contact store would keep as persistent data?
I need to be able to identify a CNContact so as to associate it with a CKRecord in a iCloud private database. If I use a non-unified contact, would the identifier be unique across all existing iOS devices so that I could store the identifier property in a record in the user's iCloud private database to identify a specific contact? The documentation says that the identifier of a CNContact stored object is unique within the device. If I use a UUID value and store it in the iCloud private database to identify the specific contact, how would I match that with the contact? I would need to save that UUID value as part of the contact object as stored in the contact store. Is that possible without saving the UUID value in the notes property of the contact. It would be better if I could store the UUID value somewhere where the user could not access it and delete or edit it. Is there a way to make the notes property of a contact inaccessible to the user where even if he/she could see it, he would not be able to change it? I'm not very familiar with the hash and hashValue properties of NSObject object. Though unlikely, would one of those properties be able to identify a contact uniquely across all existing iOS devices so that I could store it in the user's iCloud private database in order to associate a certain record in that database with a specific contact?
Replies
0
Boosts
0
Views
564
Activity
Mar ’22
iOS app crashes when asking the permission for contact framework
This is how I request contacts framework access permission -(void)askUserToAccessContacts {   @try   {     if([CNContactStore class])     {       //iOS 9 or later       CNEntityType entityType = CNEntityTypeContacts;       if( [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined)       {         CNContactStore * contactStore = [[CNContactStore alloc] init];         [contactStore requestAccessForEntityType:entityType completionHandler:^(BOOL granted, NSError * _Nullable error) {           if(granted){             DDLogVerbose(@"Permission granted for Contacts access...");           }         }];       }       else if( [CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized)       {         DDLogVerbose(@"Permission granted for Contacts access !!!");       }       else       {         DDLogVerbose(@"Permission not granted for Contacts access !!!");       }     }         } @catch (NSException *exception) {           [[WriteLogger getWriteLogger] writeLog:@"AppDelegate" sourceClass:NSStringFromClass([self class]) methodName:NSStringFromSelector(_cmd) exception:exception exceptionDict:nil];   } } What could possibly cause the app to crash? By the way, this crash is not occurring all the time, it happens randomly when I install the app and launch it for the first time. Incident Identifier: 33DC6088-0DC6-40A1-91E5-F7A76E3154EB Hardware Model: iPhone12,8 Version: 21.10.0 (0.5.2) AppStoreTools: 13C90b AppVariant: 1:iPhone12,8:15 Beta: YES Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Date/Time: 2022-01-10 11:43:38.9707 +0530 Launch Time: 2022-01-10 11:43:17.9333 +0530 OS Version: iPhone OS 15.1 (19B74) Release Type: User Baseband Version: 3.00.00 Report Version: 104 Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Kernel Triage: VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage Thread 0 name: Thread 0 Crashed: 0 libsystem_kernel.dylib 0x00000001b73d0504 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x00000001b73d0b9c mach_msg + 76 (mach_msg.c:119) 2 libdispatch.dylib 0x000000018019127c _dispatch_mach_send_and_wait_for_reply + 520 (mach.c:815) 3 libdispatch.dylib 0x000000018019162c dispatch_mach_send_with_result_and_wait_for_reply + 56 (mach.c:2019) 4 libxpc.dylib 0x00000001f083eb9c xpc_connection_send_message_with_reply_sync + 240 (connection.c:974) 5 TCC 0x00000001e78bb0c0 tccd_send_message + 940 (TCC.c:490) 6 TCC 0x00000001e78c0e08 __TCCAccessRequest_block_invoke.213 + 876 (TCC.c:591) 7 libdispatch.dylib 0x0000000180176660 _dispatch_client_callout + 20 (object.m:560) 8 libdispatch.dylib 0x00000001801858b4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:1016) 9 libsystem_trace.dylib 0x000000019ac86668 _os_activity_initiate_impl + 64 (activity.c:131) 10 TCC 0x00000001e78bc4e0 TCCAccessRequest + 476 (TCC.c:1019) 11 TCC 0x00000001e78ba8b8 TCCAccessRestricted + 228 (TCC.c:1682) 12 ContactsFoundation 0x000000018ce4a6ec -[CNTCCVersion2 isAuthorizationRestricted] + 96 (CNTCCVersion2.m:79) 13 ContactsFoundation 0x000000018ce034a4 -[CNAuthorizationContext isAccessRestricted] + 52 (CNAuthorizationContext.m:90) 14 Contacts 0x0000000185c42b04 +[CNAuthorization isAccessRestrictedForEntityType:] + 72 (CNAuthorization.m:26) 15 Contacts 0x0000000185c5ba30 +[CNAuthorization authorizationStatusForEntityType:] + 40 (CNAuthorization.m:66) 16 ios_app 0x00000001024bc724 -[MainAppDelegate askUserToAccessContacts] + 84 (MainAppDelegate.m:1338) 17 ios_app 0x00000001024b61b8 -[MainAppDelegate application:didFinishLaunchingWithOptions:] + 1520 (MainAppDelegate.m:228) log.crash
Replies
0
Boosts
0
Views
1.5k
Activity
Feb ’22
CNContact strange error - what does it mean?
Xcode 13.2 Using CNContact seeing the error in the log: ... [framework] Resetting database at nil path is not allowed .... What does this mean? What causes this to happen? How do I avoid this? Any help appreciated! Steve
Replies
1
Boosts
0
Views
936
Activity
Feb ’22
[iOS 15] Match INPerson with CNContact for incoming INStartCallIntent
I'm trying to break through focus mode in my app that receives VOIP notifications. I've added a particular contact to the "allowlist" for a particular focus mode. When I receive a call from my app, I create an INStartCallIntent. To create the INPerson, I use an INPersonHandle with the value being the identifier that I fetch from the contact. There are also 2 other identifier fields in INPerson that are both nullable (contactIdentifier and customIdentifier). I've also tried populating those with the fetched contact's identifier. Here's my general prototyped code (yes I know this is all hard coded, but it's just a prototype for now).      INPersonHandle *handle = [[INPersonHandle alloc] initWithValue:identifier type:INPersonHandleTypeUnknown];     INPerson *caller = [[INPerson alloc] initWithPersonHandle:handle                           nameComponents:nameComponents                            displayName:name                               image:nil                         contactIdentifier:identifier                          customIdentifier:nil                        isContactSuggestion:NO                           suggestionType:INPersonSuggestionTypeSocialProfile];     NSDate *_Nonnull dateCreated = [NSDate date];     INCallRecord *const callRecord = [[INCallRecord alloc] initWithIdentifier:callId                                    dateCreated:dateCreated                                   callRecordType:INCallRecordTypeRinging                                   callCapability:callCapability                                    callDuration:nil                                       unseen:nil                                    participants:@[caller]                                   numberOfCalls:@(1)                                 isCallerIdBlocked:nil];     INStartCallIntent *const intent = [[INStartCallIntent alloc] initWithCallRecordFilter:nil                                      callRecordToCallBack:callRecord                                           audioRoute:INCallAudioRouteSpeakerphoneAudioRoute                                        destinationType:INCallDestinationTypeNormal                                            contacts:@[caller]                                         callCapability:callCapability];     // Donate the interaction to Siri     INInteraction *const interaction = [[INInteraction alloc] initWithIntent:intent response:nil];     interaction.direction = INInteractionDirectionIncoming;     [interaction donateInteractionWithCompletion:nil]; Nothing I've tried yet has been able to break through focus mode and I think it's because the identifiers aren't matching up. Apple seems to have a clear way to match contacts for email address and phone number identifiers, but it's unclear how they match based on an unknown type for the INPersonHandleType.
Replies
0
Boosts
0
Views
817
Activity
Dec ’21
How do I write code to run when the contact store was changed by another app, but not run when the contact store was changed by my app?
I noticed that when my app changes the contact store, the CNContactStoreDidChange notification fires in my app. How do I check if the notification fired because my app changed it. Is there a way to know which app made the change to the contact store. I need to know so I can write code to run only if the contact store was changed by another app instead of my app.
Replies
1
Boosts
0
Views
764
Activity
Dec ’21