iPhone SDK Accessing Address book company contact -


I am able to use SDK to access address book contacts for people, but whenever I select a contact I'm a company, my app crashes.

Do anyone know the property of the company's area? Does anyone know the code to do this work?

Thanks in advance

It seems that your problem is not related to the company tag The areas of AB need to be carefully managed, are not released after release and all the time is checked for zero, many fields are not set.

In principle, here is an example of how I use it. This function loads contacts (those fields are interested in my app) and gives the caller an array with contacts. Hope it's useful to note how I do not leave the need for rifolds.

  - (NSArray *) Load Communications {ABAddressBookRef Address Book = ABAddressBookCreate (); CFArrayRef All People = ABAddressBookCopyArrayOfAllPeople (Address Book); CFIndex nPeople = ABAddressBookGetPersonCount (Address Book); NSMutableArray * Contact = [NSMutableArray array]; For (Int i = 0; I & lt; n people, i ++) {ABRCordorph Engineer = CFRRAGETAULT & X (All People, I); NSString * firstName = ABRecordCopyValue (person, KABPersonFirstNameProperty); NSString * lastName = ABRecordCopyValue (person, K. B.P.S.N.L.property); NSString * fullName; If (firstName & lastName) {fullName = [NSString stringWithFormat: @ "% @% @", first name, lastName]; } Else {if (firstName) {fullName = [NSString stringWithString: firstName]; } Else if (last name) {full name = [NSString stringWithString: lastName]; } And {continue; }} NSString * Email = Zero; ABMultiValueRef Email = ABRecordCopyValue (person, kABPersonEmailProperty); If (email) {NSArray * emailAddresses = [(NSArray *) ABMultiValueCopyArrayOfAllAllsValues ​​(email) autorelease]; If (Email Address & amp; Email Address Counting> & gt; 0) Email = [Email Address ObjectOut Index: 0]; CFRelease (email); } If (email) {NSDictionary * contact = [Object andkey with NSDictionary dictionary: Full name, @ "name", email, @ "email", zero]; [Contact addObject: contact]; } If (first name) CFRighs (first name); If (last name) CFRlim (last name); } CFRs (all people); CFRelease (Address Book); Return contact; }  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -