abaddressbook

How to delete record in iPhone address book using ABAddressBook?

℡╲_俬逩灬. 提交于 2019-12-22 09:46:07
问题 I was learning the addressbook framework and then I wanted to delete the record from the the iPhone contact book. I checked up the documentation and found a function called ABAddressBookRemoveRecord , but I can't find out a way to delete the records, like the user will select a record and then hit the delete button and then the record will get deleted. All I did till now is banged my head over the documentation and that's all. Can you please provide me a link or an example how to delete a

How do you access the current user's record in Address Book?

偶尔善良 提交于 2019-12-22 06:32:13
问题 Is there a way in the Address Book API to access the current user's record programatically? In other words, if this iPhone belongs to John Smith, to get the contact record that is John Smith (whichever record is marked as Me in Contacts)? Obviously you can popup the picker and let the user select themselves from their Contacts, but this seems like an unnecessary action for the user to take. Use case: I have a form in my app and I'd like to pre-populate the form for the user based on their

Why would ABAddressbookRef need to be created for each thread?

南楼画角 提交于 2019-12-22 04:29:15
问题 Apple says: Important: Instances of ABAddressBookRef can not be used by multiple threads. Each thread must make its own instance. But why? I know that some particular class or operations must be done in main thread. And I know some objects are not thread-safe (which means it would cause problem if these objects are accessed by two different threads concurrently). But, if you can make sure that the the thread-unsafe objects are accessed by only one thread at any moment, then there should be

iOS Getting selected contacts' email address in array

社会主义新天地 提交于 2019-12-21 21:25:57
问题 What I'm trying to do is show the people picker to the user, make him select all the contacts he wants, and finally get all those contacts' email addresses in an array. The best would be showing only contacts with email to the user. Until now the only thing I've been able to do is presenting the people picker with this code: ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; picker.peoplePickerDelegate = self; [self presentModalViewController

Programmatically create a group in contacts

╄→尐↘猪︶ㄣ 提交于 2019-12-21 06:45:06
问题 How to programmatically add a new group to the iPhone contact using AddressBook framework? 回答1: First look and see if it exists, and if not, create it: bool foundIt = NO; // Protective - did we just not find it, or lose it? CFArrayRef groups = ABAddressBookCopyArrayOfAllGroups(addrBook); CFIndex numGroups = CFArrayGetCount(groups); for(CFIndex idx=0; idx<numGroups; ++idx) { ABRecordRef groupItem = CFArrayGetValueAtIndex(groups, idx); CFStringRef name = (CFStringRef)ABRecordCopyValue(groupItem

Programmatically create a group in contacts

删除回忆录丶 提交于 2019-12-21 06:42:45
问题 How to programmatically add a new group to the iPhone contact using AddressBook framework? 回答1: First look and see if it exists, and if not, create it: bool foundIt = NO; // Protective - did we just not find it, or lose it? CFArrayRef groups = ABAddressBookCopyArrayOfAllGroups(addrBook); CFIndex numGroups = CFArrayGetCount(groups); for(CFIndex idx=0; idx<numGroups; ++idx) { ABRecordRef groupItem = CFArrayGetValueAtIndex(groups, idx); CFStringRef name = (CFStringRef)ABRecordCopyValue(groupItem

iOS 6 address book empty kABPersonPhoneProperty

眉间皱痕 提交于 2019-12-21 04:55:15
问题 In my code I use ABPeoplePickerNavigationController to select person. After user select person from contact list, I look if specified person record have any phone number: - (BOOL) peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { ABMutableMultiValueRef phones; phones = ABRecordCopyValue(person, kABPersonPhoneProperty); if (phones == nil || ABMultiValueGetCount(phones) == 0) { return NO; } // other code..

NSDate return “1604” for year value?

淺唱寂寞╮ 提交于 2019-12-20 19:58:08
问题 I'm try to get birth data for contacts but if user does not choose year or the contact come from Facebook and the year or the data it self is hidden so it give me the "1604" value for the year u can see what i mean in the image. 回答1: Congratulations, you've discovered an implementation detail! First off, Contacts stores dates as points in time, and it is impossible to store a point in time without a year, because every point in time has a year. Thus, a decision had to be made about how

Is ABRecordID a reliable way to identify unique contacts?

旧时模样 提交于 2019-12-20 17:38:28
问题 My app uploads contacts, and, in the future, will need to update them. Is using the ABRecordID a reliable way to identify people, or is it possible for a new record to obtain the ID of a deleted record? To optimize uploads, I would like to upload only the records that have been modified or created since the last upload. I'm currently storing a copy of the person's contacts using core data. I'd like to slim down the footprint of my app and speed up the execution time of scanning through the

Memory leaks with AddressBook framework

孤街浪徒 提交于 2019-12-20 10:57:08
问题 I'm having some memory leaks with both ABAddressBookGetPersonWithRecordID and ABPersonSetImageData. I've been looking for solutions before posting here but I still don't understand. If I play quite a long time with the iPhone 3GS or with only a few contacts with iPhone 3G, actually the application crashes. Here is my code in the didSelectRowAtIndexPath method. I've seen sample codes with these methods and I don't see what I'm missing. Thank you in advance. (sorry for mistakes...) Contact