abaddressbook

kABPersonFirstNameProperty… trowing EXC_BAD_ACCESS

末鹿安然 提交于 2019-12-12 02:25:23
问题 Im reading the address book contacts... everything goes well until I test a contact with no First Name ( Since I can create a contact with just an email or a phone or wathever....). The code (reduced) is this: - (NSMutableArray *) getContactsInfo { NSMutableArray *contactsList = [[NSMutableArray alloc] init]; localAddressBook = ABAddressBookCreate(); int contactsLength = (int)ABAddressBookGetPersonCount(localAddressBook); if (contactsLength < 1) return nil; for(int currentContact=1;

Alternate for ABAddressBookRegisterExternalChangeCallback

谁都会走 提交于 2019-12-12 02:08:57
问题 As ABAddressBookRegisterExternalChangeCallback is deprecated in iOS 9.0 and later. Is there any alternative avaiable for getting contact change or if a new contact is added in the address book. Please provide the implementation if possible in objective-c. 回答1: Everything in the AddressBook.framework has been deprecated in iOS 9. Apple wants you to use the Contacts.framework instead. Specifically, look at CNContactStoreDidChangeNotification defined in CNContactStore . 来源: https://stackoverflow

Creating a Contacts application — What can I do to handle email/phone numbers better?

谁都会走 提交于 2019-12-12 01:44:30
问题 My application ties into the Addressbook framework for iOS, and I'm grabbing contact information. firstname lastname company name home email work email home phone work phone cell phone I need to expand on what information I'm grabbing. The issue I'm having in the app, is that it imports the contacts into the users database on the app. When this happens, if I have more than one home email(or any other email/phone field) then it imports two users. Here is my Person model #import <Foundation

contact details from ipad using objective-c

ぐ巨炮叔叔 提交于 2019-12-12 00:44:33
问题 How can I get the contact details from iPad and use it in my app. I am using the following code and getting the details from simulator. But while running in ipad i am not getting the contact image, email etc. i am getting the phone number correctly. ABAddressBookRef addressBook = ABAddressBookCreate(); // Get all contacts in the addressbook NSArray *allPeople = (__bridge NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook); for (id person in allPeople) { // Get all phone numbers of a

How do I write a custom Social Profile entry to the iOS addressbook?

流过昼夜 提交于 2019-12-11 19:46:57
问题 I am doing the following to write Facebook and Twitter addresses to a new contact in the iOS addressbook: ABMultiValueRef multiSocial = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType); ABMultiValueAddValueAndLabel(multiSocial, (__bridge CFTypeRef)([NSDictionary dictionaryWithObjectsAndKeys:(NSString *)kABPersonSocialProfileServiceFacebook, kABPersonSocialProfileServiceKey, theFacebook, kABPersonSocialProfileUsernameKey, nil]), kABPersonSocialProfileServiceFacebook, NULL);

iOS MFMailComposeViewController and getting users Name from contact card

纵饮孤独 提交于 2019-12-11 18:05:14
问题 I want to get the "Me" card's Name so when i create the mail window with MFMailComposeViewController I can MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; mailer.mailComposeDelegate = self; [mailer setSubject:@"Suggestion: from (Name of Person)"]; Basically substitute the (Name of Person) with the name on their contact card. 回答1: You can't get the "Me" card from the iOS SDK. There's a me method for the mac, but not for iOS. If the name of the person will be

Why can I access the iPhone address book contacts without being prompted?

左心房为你撑大大i 提交于 2019-12-11 10:18:27
问题 ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(nil, nil); ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) { NSArray *folks = (__bridge NSArray *)(ABAddressBookCopyArrayOfAllPeople(addressBook)); NSLog(@"%@",folks); }); I'm able to access the contacts with no prompt to the user. Opening Settings > Privacy > Contacts I see no entry for my application. (Running in Simulator) 回答1: The contacts privacy prompt doesn't work on the simulator. Try

How to create a contact in the “local” addressbook?

南楼画角 提交于 2019-12-11 10:01:01
问题 I am wanting to create a contact programmatically into the "local" addressbook (so that it doesn't try to synch, which causes some compatibility issues with Exchange). If a local addressbook already exists, I can find it using ABAddressBookCopyArrayOfAllSources to get all the sources in the Address Book, then look for the ABRecordRef with a sourceTypeRef of "kABSourceTypeLocal"- if I then pass that recordRef to ABPersonCreateInSource, I can add a record to the local directory. Does anyone

Potential Memory Leak for ABRecordCopyValue

ぃ、小莉子 提交于 2019-12-11 07:18:51
问题 I am building an app that requres me to load all the contacts in the datasource of the table from the iPhone AddressBook. On running Build and Analyze for the following snippet ABAddressBookRef addressBook = ABAddressBookCreate(); int nPeople = ABAddressBookGetPersonCount(addressBook); CFRelease(addressBook); for(int i=0; i < nPeople; i++ ){ //ABRecordRef person = [allPeople objectAtIndex:i]; NSString *name = @""; if(ABRecordCopyValue([allPeople objectAtIndex:i], kABPersonFirstNameProperty) !

Read name of ABSource

99封情书 提交于 2019-12-11 06:13:45
问题 I want to read the name of an ABSource in the addressBook framework. Is this possible? The following code sample leaves me with null, while the currentSource pointer is valid. NSString* stringName = (NSString*)ABRecordCopyValue(currentSource, kABSourceNameProperty); Thank you in advance, Martin 回答1: NSString *sourceTypeName = (NSString *)((CFStringRef)ABRecordCopyValue(source, kABSourceNameProperty)); ABSourceType sourceType = [(NSNumber *)ABRecordCopyValue(currentSource,