can any one tell me what is the error in my code . it work fine in the simulator but in the phone and with iTunes make crash. i do not what i shall do to get the error can any one Help??
(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier {
NSString* name = (NSString *) ABRecordCopyValue(person,kABPersonFirstNameProperty );
//self.firstName.text = name; [name release];
NSString* name2 = (NSString *) ABRecordCopyValue (person, kABPersonLastNameProperty);
NSString* name1= [name stringByAppendingString(angry)" "];
self.firstName.text = [name1 stringByAppendingString:name2];
ABMultiValueRef phoneProperty = ABRecordCopyValue(person,property);
NSString *phone = (NSString *)ABMultiValueCopyValueAtIndex(phoneProperty,identifier);
self.PhoneNumber.text = phone;
[name release];
[phone release];
[self dismissModalViewControllerAnimated:YES];
return NO;
}
i made changes as logancautrell advice and use ABMultiValueGetIndexForIdentifier with ABMultiValueCopyValueAtIndexas this the change was in line 11 the old line is
NSString *phone = (NSString *)ABMultiValueCopyValueAtIndex(phoneProperty,identifier);
the new line is
NSString *phone = (NSString *)ABMultiValueCopyValueAtIndex(phoneProperty,ABMultiValueGetIndexForIdentifier(phoneProperty,identifier));
I test it on my iphone it work good I test it for 3 days and no error or crash BUT when I send it to iTunes they reply
Your app crashed on both Wi-Fi and cellular networks when we select a contact from the address book.