cncontact

My app keep deny the access to contacts iOS - Swift

主宰稳场 提交于 2019-12-10 12:06:47
问题 I have a view when it get loaded it will check first the permission to access the contacts if it's Authorized, NotDetermined or Denied .. the code at first time will go with NotDetermined so it will call function to ask for access .. the problem is here in this function : private func requestContactsAccess() { //store = CNContactStore() store.requestAccessForEntityType(.Contacts) {granted, error in if granted { dispatch_async(dispatch_get_main_queue()) { self.accessGrantedForContacts() return

How to fetch iOS Contacts more quickly using Apple's Contacts framework having long list of contacts?

牧云@^-^@ 提交于 2019-12-07 15:39:51
问题 I am using CNContacts to fetch phonebook contacts in my iOS device. When I have a small number of contacts in my phone (say, 50) the contacts are fetched easily. However, when I have a lot of contacts (say 500-700) it hangs/waits for a long time to fetch these contacts from iOS phonebook into my App's array. Previously I used https://github.com/Alterplay/APAddressBook which was a fast library for the previous Apple framework, but now I am using the latest Apple framework. My code to fetch

CNContact last modified date and contacts changed

痞子三分冷 提交于 2019-12-06 21:38:36
问题 Questions: How to get the last modified date in CNContact (new apple contacts framework) ? The last modified date is not present in the list of keysToFetch I would like to fetch and update contacts that have been modified since my last fetch. How can I do this ? 回答1: According to the Apple Staff reply, no api for that right now. https://forums.developer.apple.com/thread/16049 To perform nearly the same thing, I would suggest using enumerateContactsWithFetchRequest:error:usingBlock: Assuming

How to add contacts custom app account like below screen shot

我的梦境 提交于 2019-12-06 10:31:12
问题 I'm developing an app which needs its own contacts to be visible in their contacts. Like Whatsapp, I need to show the contact nos that they are registered in my app. For example, If you add a Friend's whatsapp no in contacts, it will show Found in Whatsapp . So I'm also need the same kind of functionality for my app. When i install my app, my app should be added to the above list. (Have a look at above screenshot). I've searched and found nothing about this. So any help would be greatly

CNContact add new contact issue

旧时模样 提交于 2019-12-06 09:43:40
问题 I'm faccing an issue at time of adding contacts throught Contact Framework . I used device iPhone 5s with iOS 12.1.2 My Code for adding contact is as below :: let saveRequest = CNSaveRequest() saveRequest.add(self, toContainerWithIdentifier: nil) do { try contactStore.execute(saveRequest) } catch let error { print("Error occurred while saving the request \(error)") } This everytime thows error as below :: Error occurred while saving the request Error Domain=CNErrorDomain Code=1 "Communication

How to retrieve all contacts using CNContact.predicateForContacts?

馋奶兔 提交于 2019-12-06 05:35:25
问题 So I have this code which works fine, but only if you have specified a name in the predicateForContacts parameter. func retrieveContactsWithStore(store: CNContactStore) { do { let predicate = CNContact.predicateForContacts(matchingName: "John") let keysToFetch = [CNContactFormatter.descriptorForRequiredKeys(for: .fullName), CNContactPhoneNumbersKey] as [Any] let contacts = try store.unifiedContacts(matching: predicate, keysToFetch: keysToFetch as! [CNKeyDescriptor]) self.objects = contacts

How to fetch only mobile numbers in swift using CNContacts?

随声附和 提交于 2019-12-06 00:37:45
问题 I have some code to retrieve all the phone numbers in the users contacts, but would like to filter out only mobile numbers. Currently, I am just doing this by only adding numbers with a first digit of "+" or second digit of "7" to an array, as shown below: func findContacts () -> [CNContact]{ let keysToFetch = [CNContactFormatter.descriptorForRequiredKeysForStyle(.FullName),CNContactPhoneNumbersKey] let fetchRequest: CNContactFetchRequest = CNContactFetchRequest(keysToFetch: keysToFetch) var

CNContact last modified date and contacts changed

非 Y 不嫁゛ 提交于 2019-12-05 03:33:25
Questions: How to get the last modified date in CNContact (new apple contacts framework) ? The last modified date is not present in the list of keysToFetch I would like to fetch and update contacts that have been modified since my last fetch. How can I do this ? According to the Apple Staff reply, no api for that right now. https://forums.developer.apple.com/thread/16049 To perform nearly the same thing, I would suggest using enumerateContactsWithFetchRequest:error:usingBlock: Assuming an individual contact is identified by name, when the name field remain the same but other infos are changed,

How to add contacts custom app account like below screen shot

耗尽温柔 提交于 2019-12-04 19:09:09
I'm developing an app which needs its own contacts to be visible in their contacts. Like Whatsapp, I need to show the contact nos that they are registered in my app. For example, If you add a Friend's whatsapp no in contacts, it will show Found in Whatsapp . So I'm also need the same kind of functionality for my app. When i install my app, my app should be added to the above list. (Have a look at above screenshot). I've searched and found nothing about this. So any help would be greatly appreciated. Just add the below snippet into your info.Plist to get your app name in list <key

What is the “:ABPerson” string in CNContact identifier?

放肆的年华 提交于 2019-12-04 15:57:32
问题 My iOS application checks contacts from time to time and imports new to its own database. I checks that contact already exists by identifier field, that usually filled by UUID: CNContactStore *store = [CNContactStore new]; [store requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError *error) { if (granted) { NSArray *keys = @[CNContactNamePrefixKey, CNContactGivenNameKey, CNContactMiddleNameKey, CNContactFamilyNameKey, CNContactInstantMessageAddressesKey];