I'm at a dead end.
I am trying to get a list of all the email addresses that a person has. I use ABPeoplePickerNavigationControllerto choose a person who all seems beautiful. I set my
ABRecordRef personDealingWith;
from argument personto
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
and everything seems beautiful up to this point. The first time the following code is executed, everything is fine. The next time I start, I may get problems. First, the code:
ABMultiValueRef multi = ABRecordCopyValue(personDealingWith, kABPersonEmailProperty);
CFIndex emailCount = ABMultiValueGetCount(multi);
if (emailCount > 0) {
for (CFIndex i = 0; i < emailCount; i++) {
CFStringRef emailRef = ABMultiValueCopyValueAtIndex(multi, i);
[emailArray addObject:(NSString *)emailRef];
CFRelease(emailRef);
}
}
CFRelease(multi);
If they are compiled as written, these are not errors or problems of static analysis. This is crashing with
*** -[Not A Type retain]: message sent to deallocated instance 0x4e9dc60
error.
But wait, there still! I can fix this in one of two ways.
-, NSLog . NSLog ABRecordCopyValue , , , .
,
CFRelease(multi);
, . , .
, . , . .
- , ?