You are using __bridge_transfer
everywhere except for the phoneNumbers
return value from ABRecordCopyValue
.
You need to transfer ownership of phoneNumbers
to ARC or manually release the memory.
UPDATE: Having looked at this issue a bit closer I'm not sure you can transfer ownership to ARC, see __bridge_transfer and ABRecordCopyValue: and ARC for more details.
Adding CFRelease(phoneNumbers)
will manually release the memory.
For example:
NSString* phoneNum = nil;
ABMultiValueRef phoneNumbers;
phoneNumbers = ABRecordCopyValue(person,
kABPersonPhoneProperty);
if (ABMultiValueGetCount(phoneNumbers) > 0) {
phoneNum = (__bridge_transfer NSString*) ABMultiValueCopyValueAtIndex(phoneNumbers, 0);
} else {
phoneNum = @"Unknown";
}
CFRelease(phoneNumbers);