It looks like you are confusing NS data types with CF data types. Address book methods typically return basic foundation ( CF ) objects. These facilities are free bridges, which means they can be used interchangeably with NS types.
When using basic base objects, any method with a “copy” in its name returns an object that you later need to free using CFRelease . Only if you apply it to the NS equivalent can you use - release .
Thus, your code can be written as one of the following:
ABMultiValueRef phone = ABRecordCopyValue(person, kABPersonPhoneProperty); NSString *mobilephone = (NSString *)ABMultiValueCopyValueAtIndex(phone, 0);
or
ABMultiValueRef phone = ABRecordCopyValue(person, kABPersonPhoneProperty); CFStringRef mobilephone = ABMultiValueCopyValueAtIndex(phone, 0);
source share