abaddressbook

How do I correctly use ABAddressBookCreateWithOptions method in iOS 6?

余生颓废 提交于 2019-11-27 17:37:02
I am trying to understand the ABAdressBookCreateWithOptions and ABAddressBookRequestAccessWithCompletion methods in iOS 6. The most information i have been able to find is the following, "To request access to contact data, call the ABAddressBookRequestAccessWithCompletion function after calling the ABAddressBookCreateWithOptions function." I believe together these methods should alert the user to decide whether to allow the application access to contacts, however when I use them I am seeing no prompt. Could someone provide some sample code of how these methods should be called together in a

How to add new contact to iOS Contacts (Address Book)?

Deadly 提交于 2019-11-27 13:58:19
问题 I want to save contact directly to an iOS device's Address Book programmatically. How can I do it? 回答1: Here is a small example : CFErrorRef error = NULL; NSLog(@"%@", [self description]); ABAddressBookRef iPhoneAddressBook = ABAddressBookCreate(); ABRecordRef newPerson = ABPersonCreate(); ABRecordSetValue(newPerson, kABPersonFirstNameProperty, people.firstname, &error); ABRecordSetValue(newPerson, kABPersonLastNameProperty, people.lastname, &error); ABMutableMultiValueRef multiPhone =

ABAddressBook ABSource and ABSourceType

你说的曾经没有我的故事 提交于 2019-11-27 13:22:33
I am attempting to create an app that can be used to search an Exchange GAL, however, I am finding the new 4.0 documentation regarding this subject confusing. Does anyone know how I might go about searching the GAL for names containing a specific string (e.g. "Smi")? My source code at the moment is all but useless as I am simply trying to wrap my head around how to specify that I am wanting only to search the GAL and not the local contacts on the device. Also, how is kABSourceTypeSearchableMask used? I am missing something fundamental here. From the documentation... Source Types These

iOS 6 Address Book not working?

你说的曾经没有我的故事 提交于 2019-11-27 12:28:53
My method of programmatically retrieving e-mail addresses from the Address Book no longer seems to work on iOS 6 devices. It worked in iOS 5 and oddly, still works in the iOS 6 Simulator. Is there a new way to programmatically retrieve contacts from a users' Address Book? ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); self.contacts = [[NSMutableArray alloc] init]; int contactIndex = 0; for (int i = 0; i < nPeople; i++) { // Get the next address book record.

Get iPhone phone number label from Address Book

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 11:43:02
问题 So I have a method to get all the contact phone numbers from the address book on the iPhone, but is there a way to get the phone number label? For example you can do this: And I'd be looking to modify my method to print out the label (such as iPhone/Home/mobile/etc). ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef all = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex n = ABAddressBookGetPersonCount(addressBook); for( int i = 0 ; i < n ; i++ ) { ABRecordRef ref =

Accessing iOS Address Book with Swift: array count of zero

北城余情 提交于 2019-11-27 11:26:31
I am trying to write a simple method to ask a user for access to their address book and then print out the name of each person in the address book. I've seen a number of tutorials explaining how to do this in objective-C, but am having a hard time converting them to swift. Here's what I've done so far. The below block runs in my viewDidLoad() method and checks to see whether the user has authorized access to the address book or not, if they have not authorized access yet, the first if-statement will ask for access. This section works as expected. var emptyDictionary: CFDictionaryRef? var

Dealing with duplicate contacts due to linked cards in iOS' Address Book API

被刻印的时光 ゝ 提交于 2019-11-27 09:21:33
问题 Some beta-users of my upcoming app are reporting that the list of contacts contain a lot of duplicate records. I'm using the result from ABAddressBookCopyArrayOfAllPeople as the data source for my customized table view of contacts, and it baffles me that the results are different from the iPhone's 'Contacts' app. When looking more closely at the Contacts app, it seems that the duplicates originate from entries with "Linked Cards". The screenshots below have been obfuscated a bit, but as you

Detect what was changed from ABAddressBookRegisterExternalChangeCallback

心不动则不痛 提交于 2019-11-27 08:08:35
I am using ABAddressBookRegisterExternalChangeCallback to get the external changes in AddressbookBook of the user. I am using the following code to register the callback: ABAddressBookRef ntificationaddressbook = ABAddressBookCreate(); ABAddressBookRegisterExternalChangeCallback(ntificationaddressbook, MyAddressBookExternalChangeCallback, self); and when this callback is called then MyAddressBookExternalChangeCallback is called successfully void MyAddressBookExternalChangeCallback (ABAddressBookRef ntificationaddressbook,CFDictionaryRef info,void *context) { NSLog(@"Changed Detected......"); }

How does Square's CardCase app automatically populate the user's details from the address book?

て烟熏妆下的殇ゞ 提交于 2019-11-27 02:56:21
Square's new card case iOS app has a "Create Account" feature. Tap it and it shows a form PREPOPULATED with the user's entry from the Address book. How is this possible? Anyone know? I thought this was unpossible, to get the user's info this way. It's not an iOS 5.0 thing, afaict. the only solution I could come up with was using the device name and then searching the addressbook for a match. this assumes someone would use a particular naming convention. I for example use 'Nik's iPhone' as my device name. I am also the only Nik in my addressbook, so for my scenario is works well to use the text

Obtaining Specific ABSource from ABAddressBook in iOS 4+

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 01:47:17
Does anyone have an example of how to obtain a specific ABSource from the ABAddressBook in iOS 4+? iOS 4+ provides new API that allows one to select a specific ABSource from the ABAddressBook. This may be useful as some operations, e.g. creating an ABGroup, are not supported in some sources (i.e. Exchange). "Not all source types support groups, more conspicuously, Exchange does not know anything about groups." - http://flavors.me/volonbolon#1a5/tumblr Attached are functions that leverage the new API to obtain sources of specific types which may be used in calls to ABGroupCreateInSource().