abaddressbook

Is it possible to find user’s contacts that also have Apple devices?

萝らか妹 提交于 2019-12-08 08:26:56
问题 Given the iOS Address Book API, or possibly other App Store friendly APIs, is it possible to find the user’s contacts that also use iOS? The only heuristic I was able to come up with was finding all contacts that have a kABPersonPhoneIPhoneLabel phone number – but that method has a lot of both false positives and negatives. 回答1: This is now possible using CloudKit and the CKDiscoverAllContactsOperation class. You only get the user’s contacts that also use the same app and have given an

ios memory leak when accessing phone book

梦想与她 提交于 2019-12-08 05:02:37
问题 - (NSArray *)getAllContacts{ CFErrorRef *error = nil; ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, error); __block BOOL accessGranted = NO; if (ABAddressBookRequestAccessWithCompletion != NULL) { // we're on iOS 6 dispatch_semaphore_t sema = dispatch_semaphore_create(0); ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) { accessGranted = granted; dispatch_semaphore_signal(sema); }); dispatch_semaphore_wait(sema, DISPATCH_TIME

Addressbook Save Image for contacts programmatically

风流意气都作罢 提交于 2019-12-08 04:30:22
问题 I am creating an addressbook application in that all the data are stored to server and when User will ask then server will restore all the contacts to iPhone. My problem is how to send Image to server as well as how I will be able to restore the contact Image , I came to know that my server will provide me an Image in base64 encryption format. So can any help me how to perform image saving and retrieving for Addressbook Programmatically 回答1: You need to convert the base64 image in nsdata and

App crashing while fetching contact numbers from iPhone in SWIFT

半世苍凉 提交于 2019-12-08 03:13:45
问题 I am trying to get the contacts using the following code: var addressBook: ABAddressBook! let addressBookRef: ABAddressBook = ABAddressBookCreateWithOptions(nil, nil).takeRetainedValue() var arrContacts = [""] var personNameContactNo:[String: String] = ["":""] var arrOfDictContacts = NSMutableArray() var Name: String! if let people = ABAddressBookCopyArrayOfAllPeople(addressBook)?.takeRetainedValue() as? NSArray { for person in people{ if let name = ABRecordCopyValue(person,

ABPeoplePickerNavigationController customisation

左心房为你撑大大i 提交于 2019-12-08 02:39:25
I want to use ABPeoplePickerNavigationController but I want to customise the view. I want to have an accessory image by some of the contacts, and I want to sort them in a different way than the default one. Is there a way to do it? Or do I have to create my own UITableViewController ? You'll have to create your own table view if you want to customize the appearance of the contacts in this manner. For example, you can extract the contacts using: - (void)loadContacts { ABAuthorizationStatus status = ABAddressBookGetAuthorizationStatus(); if (status == kABAuthorizationStatusDenied) { // if you

Missing contacts in ABAddressBookCopyArrayOfAllPeople

不打扰是莪最后的温柔 提交于 2019-12-08 01:34:37
问题 Im trying to find a phone number in the address book from my app and I was surprised not to find it. The thing is that I've printed all the numbers of my address book in the console accessed by my app and strangely some of the contacts are missing, I was comparing the output with my address book, it's only few, but still. This is how Im accesing the AddressBook: ABAddressBookRef addressBook = ABAddressBookCreate(); NSArray *people = (NSArray *) ABAddressBookCopyArrayOfAllPeople(addressBook);

Customizing Title in the NavigationBar for a ABPeoplePickerNavigationController

可紊 提交于 2019-12-07 09:55:28
问题 I have created an AddressBook kind of application where I display a list of people in a UITableView, when a person is selected an ABUnknownPersonViewController is pushed. From this ABUnknownPersonViewController the user is able (by using the built in functionality) to either add the person to a "New Contact" or "Existing Contact". This is where my problem is located. I am using a Custom UILabel for the NavigationBar title throughout my application. And I need to be able to do this for the

Swift filter array using NSPredicate

只愿长相守 提交于 2019-12-07 03:18:06
问题 I have an application written in Swift that is pulling in the users contacts from their address book. I want to filter out the contact that only contain a company name (so that you get your "assumed" real person contact and not businesses) Here is how this is being accomplish in the Objective-C version of my app: NSArray *allContacts = (__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook); NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id person,

App crashing while fetching contact numbers from iPhone in SWIFT

谁说胖子不能爱 提交于 2019-12-06 16:44:11
I am trying to get the contacts using the following code: var addressBook: ABAddressBook! let addressBookRef: ABAddressBook = ABAddressBookCreateWithOptions(nil, nil).takeRetainedValue() var arrContacts = [""] var personNameContactNo:[String: String] = ["":""] var arrOfDictContacts = NSMutableArray() var Name: String! if let people = ABAddressBookCopyArrayOfAllPeople(addressBook)?.takeRetainedValue() as? NSArray { for person in people{ if let name = ABRecordCopyValue(person, kABPersonFirstNameProperty).takeRetainedValue() as? String { Name = name } let numbers:ABMultiValue = ABRecordCopyValue(

Addressbook Save Image for contacts programmatically

心已入冬 提交于 2019-12-06 15:45:12
I am creating an addressbook application in that all the data are stored to server and when User will ask then server will restore all the contacts to iPhone. My problem is how to send Image to server as well as how I will be able to restore the contact Image , I came to know that my server will provide me an Image in base64 encryption format. So can any help me how to perform image saving and retrieving for Addressbook Programmatically You need to convert the base64 image in nsdata and then you can set it to a contact, check "ABPersonSetImageData" in following code. ABRecordSetValue(newPerson