abaddressbook

Is this the right way to delete a contact from the iPhone?

六眼飞鱼酱① 提交于 2019-12-03 21:58:42
I am trying to delete a contact from the iPhone which I have created. I tried to find a good working example of deleting a contact, however didn't find one. Adding a contact seemed quite easy but deleting one seems hard. The following code does not work, but it seemed to be plausible: ABAddressBookRef addressBook = ABAddressBookCreate(); ABRecordRef delete = ABPersonCreate(); ABRecordSetValue(delete, kABPersonFirstNameProperty, @"Max", nil); ABRecordSetValue(delete, kABPersonLastNameProperty, @"Mustermann", nil); ABAddressBookRemoveRecord(addressBook, delete, &error); ABAddressBookSave

ABRecordCopyValue and ABPropertyID crash

孤街醉人 提交于 2019-12-03 21:22:17
I'm trying to retrieve data from the iPhone address book and I have some problems. First of all, I have an array of all contacts ( self.allContacts ): ABAddressBookRef abRef = ABAddressBookCreate(); self.allContacts = (NSMutableArray*)ABAddressBookCopyArrayOfAllPeople(abRef); I also have an array of all properties (each property as string) called self.allKeys . The crash occurs when I try to get the properties using a property from self.allKeys : NSString *currentRecord = [[NSString alloc] init]; ABRecordRef currentRecordRef; ABPropertyID currentFieldProperty; currentRecordRef = (ABRecordRef)

iOS - How to search a “searchable” ABSource, with ABSourceType | kABSourceTypeSearchableMask

烂漫一生 提交于 2019-12-03 16:23:30
问题 Has anyone ever succeeded in searching for names in an Exchange GAL linked to an iOS device, using ABAddressBook framework, or otherwise? I've managed to get all the names from the contacts stored on the device - that bit's easy - but it doesn't include names from the Exchange GAL. I've also managed to get the ABSource for the GAL. It's type is: kABSourceTypeExchangeGAL = kABSourceTypeExchange | kABSourceTypeSearchableMask This suggests the source is searchable, given that the

How to get an iPhone address book contact's emails as NSStrings?

十年热恋 提交于 2019-12-03 15:55:05
I know that there can be multiple values for an email, but I'm not sure how to browse through them. I can get a person correctly. ABRecordRef person = // getting a person; NSString* emails = (NSString *)ABRecordCopyValue(person, kABPersonEmailProperty); ... what's next? If I try to print the emails variable I get: Emails: <NSCFType: 0x4018d40> It is because emails should not be a string, but an array. People can have many emails! ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty); CFStringRef email = ABMultiValueCopyValueAtIndex(emails, <INDEX>); NSLog( (NSString *)

IOS AddressBook is not fetching all the phone number from contact list

人盡茶涼 提交于 2019-12-03 15:12:34
I am using Addressbook in my IOS app to fetch the contact name and numbers, but a strange thing is happening that it is showing phone number of some of the contacts. I was hoping it will show all the contact list with phone number. so here is my code to fetch phone numbers: -(void)getAddressbookData { #if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000 ABAddressBookRef addressBook = ABAddressBookCreate(); #else CFErrorRef *error = nil; ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, error); #endif NSArray * people; BOOL accessGranted = [self __addressBookAccessStatus:addressBook];

Correct vCard format for iOS devices?

好久不见. 提交于 2019-12-03 12:25:15
问题 In iOS 5 and above, Apple introduced the ABPersonCreatePeopleInSourceWithVCardRepresentation method, which is pretty useful in feeding a vCard to the Address Book and getting back the ABRecordRefs for the persons created. However, the Apple vCard seems to be (at least a bit) different from a standard vCard, as I have found out while trying to add standard vCards to the Address Book. Is there a page somewhere detailing what the Apple-format for a vCard should be? Thanks! 回答1: The

How to select a contact with ABPeoplePickerNavigationController in Swift?

霸气de小男生 提交于 2019-12-03 11:23:13
问题 I have added the ABPeoplePickerNavigationController into my first view controller. I want that when I select a contact show the info to show in other view controller, but I'm trying use my code and this not show never when I click in a contact. This only open the contact into native app ABPeoplePickerNavigationController . var people = ABPeoplePickerNavigationController() var addressBook: ABAddressBookRef? func extractABAddressBookRef(abRef: Unmanaged<ABAddressBookRef>!) -> ABAddressBookRef?

Customizing table cell in ABPeoplePickerNavigationController

末鹿安然 提交于 2019-12-03 11:16:55
I've spent some time searching for this answer on SO, but couldn't find it, so here goes: I'm starting with an ABPeoplePickerNavigationController, and when a user taps a person, they'll be taken to an ABPersonViewController where they'll be able to select phone numbers and email addresses. After they're finished with the ABPersonViewController, they'll be taken back to the ABPeoplePickerNavigationController. Pretty simple stuff. What I want is to add a detailLabel to the table cell they selected in ABPeoplePickerNavigationController after they chose a phone number or an email address.

Copying contacts from one source to another

旧街凉风 提交于 2019-12-03 08:59:30
I'm trying to copy contacts between my Local contact source and the iCloud contact source and I'm not seeing any results. This code executes without error and seems like it should work, but I don't see the newly created contacts afterward. Anyone see any issues with it? ABAddressBookRef addressBook = ABAddressBookCreate(); ABRecordRef abSourceSource = ABAddressBookGetSourceWithRecordID(addressBook, kABSourceTypeLocal); ABRecordRef abDestinationSource = ABAddressBookGetSourceWithRecordID(addressBook, kABSourceTypeCardDAV); CFArrayRef sourceContacts = ABAddressBookCopyArrayOfAllPeopleInSource

NSDate return “1604” for year value?

若如初见. 提交于 2019-12-03 05:55:51
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. 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 Address Book would store an "unknown" year in a date. It was decided that "1604" would be a fine year, for several