Contacts

RSS for tag

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

Posts under Contacts tag

196 Posts

Post

Replies

Boosts

Views

Activity

vcf file not giving option to save contact is it default behaviour that have been changed in ios13
I have been using your one of package https://packagist.org/packages/jeroendesloovere/vcardto generate the vcf file to save the contact in phone contact and it was working fine earlier.but now I think there are something changes in ios13 or what but now when vcf file downloads in the iPhone it's not opening the correct screen.is there anything we can do to open up the screen with the save option
1
0
1.2k
Aug ’22
How to cache Contacts in iOS?
I want to check if my code to cache contacts data while my iOS app is running is done well or not. Anyone have any samples I can look at. I did a search on the internet and cannot find much. Maybe code to cache any time of cache would help for me to look at. I am using Xcode 13.4.1, and my app is intended to install on iOS 12.0 up to the most current iOS version. I seem to remember a search class in one of Apple's frameworks for iOS. I don't remember if that was part of the Contacts Framework. I also will have a cache for the Contacts data that I store in CloudKit, so I take that into account to be looking for any way that might make the Contacts cache and the CloudKit cache work together.
0
0
750
Aug ’22
a problem when subclassing CNContact using swift
Hello There; Using macOS 12.5 & Xcode 13.4 I am trying to subclass CNContact and bumping into an issue that I do not understand! class MyContact: CNContact { var newVariable :String = "" ... } I have loaded contactArray:[CNContact] now as I iterate over this array I would like to typecast the instance of CNContact to an instance of MyContact. for thisContact in contactArray { if let myK:MyContact = thisContact as? MyContact { //do something } } program flow simply never proceeds into the if let statement... if I try to force this issue: let myK:MyContact = thisContact as! MyContact I get the error: Could not cast value of type 'CNContact' (0x2057a35b8) to 'XYZ.MyContact' (0x102484490). Please help me accomplish my goal - what am I not understanding here? All help appreciated! Steve
1
1
1.1k
Aug ’22
Sorting Contacts
I am using the Contacts API for my iOS app to fetch contacts. I currently sort the fetched contacts alphabetically, but was wondering if there is any ability to rank and sort them by "highest interaction" (i.e. scan iMessage or phone call log to prioritize contacts)? Any insight would be appreciated. I don't think this is possible via the Contacts API from what I've read, and I haven't found any existing answer commenting on this.
1
0
1.1k
Aug ’22
CNContacts framework issues
Hey everyone, I'm having trouble finding answers to a few things that the documentation seems to be a little sparse on. I've outlined 3 major ones below: Under what circumstances do contacts get unified automatically? I've tried creating duplicate contacts and adding duplicate contacts on different containers but they are never unified automatically. Is there a way to link contacts programmatically? Since the unification process doesn't seem to be consistent we're hoping to be able to do this programmatically. Can I add a CardDAV account programmatically? I want to make it easier for my users to add an external contacts account without telling them to go to Settings > Contacts > Accounts > Add Account > Other > etc. I've noticed the upcoming changes in the iOS Beta for contact management and cleanup. Do these include any more automation or detection for Unified Contacts?
1
0
742
Jul ’22
VCard File Photo URI Support
I love how Apple products will open up a VCF File in the Contacts App and import nearly all of the information successfully.However at the moment, the only format accepted for the PHOTO field is Base64.This can make for much larger VCF Files when the VCard Specification also includes an option for a Photo URI, allowing the data to be stored elsewhere and retrieved on opening of the VCard.It would be awesome if Apple Devices could recognize and retrieve Photos located at the VCF File's specified PHOTO URI Location to allow for more compact VCF files to be distributed in various formats.Here's an example of a VCard who's PHOTO option specifies a remote URI for the imageBEGIN:VCARDVERSION:3.0N:Gump;Forrest;;Mr.;FN:Forrest GumpORG:Bubba Gump Shrimp Co.TITLE:Shrimp ManPHOTO;TYPE=JPEG;VALUE=URI:https://upload.wikimedia.org/wikipedia/commons/8/87/My_Dog_%2861220578%29.jpegTEL;TYPE=WORK,VOICE:(111) 555-1212TEL;TYPE=HOME,VOICE:(404) 555-1212ADR;TYPE=WORK,PREF:;;100 Waters Edge;Baytown;LA;30314;United States of AmericaLABEL;TYPE=WORK,PREF:100 Waters Edge\nBaytown\, LA 30314\nUnited States of AmericaADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of AmericaLABEL;TYPE=HOME:42 Plantation St.\nBaytown\, LA 30314\nUnited States of AmericaEMAIL:forrestgump@example.comREV:2008-04-24T19:52:43ZEND:VCARDThank you!
6
3
12k
Jul ’22
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
705
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
922
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.2k
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
691
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
696
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.4k
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.6k
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.9k
Mar ’22
How to fetch all contact on MacOS ?
Hello folks, I'm trying to fetch all contact from MacOS using the contact frameworks, but the documentation doesn't explain how to do it. So i'm searching for code in Swift or Objective-C (or anything else) to accomplish that.
Replies
3
Boosts
1
Views
1.3k
Activity
Sep ’22
vcf file not giving option to save contact is it default behaviour that have been changed in ios13
I have been using your one of package https://packagist.org/packages/jeroendesloovere/vcardto generate the vcf file to save the contact in phone contact and it was working fine earlier.but now I think there are something changes in ios13 or what but now when vcf file downloads in the iPhone it's not opening the correct screen.is there anything we can do to open up the screen with the save option
Replies
1
Boosts
0
Views
1.2k
Activity
Aug ’22
How to cache Contacts in iOS?
I want to check if my code to cache contacts data while my iOS app is running is done well or not. Anyone have any samples I can look at. I did a search on the internet and cannot find much. Maybe code to cache any time of cache would help for me to look at. I am using Xcode 13.4.1, and my app is intended to install on iOS 12.0 up to the most current iOS version. I seem to remember a search class in one of Apple's frameworks for iOS. I don't remember if that was part of the Contacts Framework. I also will have a cache for the Contacts data that I store in CloudKit, so I take that into account to be looking for any way that might make the Contacts cache and the CloudKit cache work together.
Replies
0
Boosts
0
Views
750
Activity
Aug ’22
a problem when subclassing CNContact using swift
Hello There; Using macOS 12.5 & Xcode 13.4 I am trying to subclass CNContact and bumping into an issue that I do not understand! class MyContact: CNContact { var newVariable :String = "" ... } I have loaded contactArray:[CNContact] now as I iterate over this array I would like to typecast the instance of CNContact to an instance of MyContact. for thisContact in contactArray { if let myK:MyContact = thisContact as? MyContact { //do something } } program flow simply never proceeds into the if let statement... if I try to force this issue: let myK:MyContact = thisContact as! MyContact I get the error: Could not cast value of type 'CNContact' (0x2057a35b8) to 'XYZ.MyContact' (0x102484490). Please help me accomplish my goal - what am I not understanding here? All help appreciated! Steve
Replies
1
Boosts
1
Views
1.1k
Activity
Aug ’22
Sorting Contacts
I am using the Contacts API for my iOS app to fetch contacts. I currently sort the fetched contacts alphabetically, but was wondering if there is any ability to rank and sort them by "highest interaction" (i.e. scan iMessage or phone call log to prioritize contacts)? Any insight would be appreciated. I don't think this is possible via the Contacts API from what I've read, and I haven't found any existing answer commenting on this.
Replies
1
Boosts
0
Views
1.1k
Activity
Aug ’22
CNContacts framework issues
Hey everyone, I'm having trouble finding answers to a few things that the documentation seems to be a little sparse on. I've outlined 3 major ones below: Under what circumstances do contacts get unified automatically? I've tried creating duplicate contacts and adding duplicate contacts on different containers but they are never unified automatically. Is there a way to link contacts programmatically? Since the unification process doesn't seem to be consistent we're hoping to be able to do this programmatically. Can I add a CardDAV account programmatically? I want to make it easier for my users to add an external contacts account without telling them to go to Settings > Contacts > Accounts > Add Account > Other > etc. I've noticed the upcoming changes in the iOS Beta for contact management and cleanup. Do these include any more automation or detection for Unified Contacts?
Replies
1
Boosts
0
Views
742
Activity
Jul ’22
VCard File Photo URI Support
I love how Apple products will open up a VCF File in the Contacts App and import nearly all of the information successfully.However at the moment, the only format accepted for the PHOTO field is Base64.This can make for much larger VCF Files when the VCard Specification also includes an option for a Photo URI, allowing the data to be stored elsewhere and retrieved on opening of the VCard.It would be awesome if Apple Devices could recognize and retrieve Photos located at the VCF File's specified PHOTO URI Location to allow for more compact VCF files to be distributed in various formats.Here's an example of a VCard who's PHOTO option specifies a remote URI for the imageBEGIN:VCARDVERSION:3.0N:Gump;Forrest;;Mr.;FN:Forrest GumpORG:Bubba Gump Shrimp Co.TITLE:Shrimp ManPHOTO;TYPE=JPEG;VALUE=URI:https://upload.wikimedia.org/wikipedia/commons/8/87/My_Dog_%2861220578%29.jpegTEL;TYPE=WORK,VOICE:(111) 555-1212TEL;TYPE=HOME,VOICE:(404) 555-1212ADR;TYPE=WORK,PREF:;;100 Waters Edge;Baytown;LA;30314;United States of AmericaLABEL;TYPE=WORK,PREF:100 Waters Edge\nBaytown\, LA 30314\nUnited States of AmericaADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of AmericaLABEL;TYPE=HOME:42 Plantation St.\nBaytown\, LA 30314\nUnited States of AmericaEMAIL:forrestgump@example.comREV:2008-04-24T19:52:43ZEND:VCARDThank you!
Replies
6
Boosts
3
Views
12k
Activity
Jul ’22
How to integrate with iOS Spotlight contact search?
How to make your app show up in Spotlight’s video call option under contact search? As shown in the attached screenshot. Any tutorial is appreciated.
Replies
0
Boosts
0
Views
1k
Activity
Jul ’22
Is it possible to add support for contacts "Found in..." to my app?
In the contacts app there are contacts included that include "Siri found in Mail". I have an app that includes a directory of contact information. Is it possible to include contacts found in my app to the system?
Replies
0
Boosts
0
Views
763
Activity
Jun ’22
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
705
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
922
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.2k
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
681
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
980
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
691
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
696
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.4k
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.3k
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.6k
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.9k
Activity
Mar ’22