Llamar a la function 'ABRecordCopyValue' devuelve un object corefoundation con un recuento de +1 retener

Tengo el siguiente código en mi proyecto

- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { [popContactsForm dismissPopoverAnimated:YES]; [ssemailvc setName: (NSString *)ABRecordCopyValue(person,kABPersonFirstNameProperty)]; ABMultiValueRef emails = (NSString *)ABRecordCopyValue(person,kABPersonEmailProperty); if (ABMultiValueGetCount(emails)>0) { [ssemailvc setEmail:(NSString *)ABMultiValueCopyValueAtIndex(emails,0)]; }else [ssemailvc setEmail:@""]; CFRelease(emails); [peoplePicker dismissModalViewControllerAnimated:YES]; [popEmailForm setPopoverContentSize:CGSizeMake(350.0, 225.0)]; return NO; } 

Estoy siguiendo las advertencias

1. llamar a la function 'ABRecordCopyValue' devuelve un object corefoundation con un +1 retener recuento 2.object filtrado: el object asignado no se hace reference más adelante en la ejecución y tiene un recuento de retención de +1

Por favor, dime cómo superar este problema

Si usa ARC, puede usar un reparto de bridge:

 CFStringRef name = (CFStringRef)ABRecordCopyValue(person,kABPersonFirstNameProperty); [ssemailvc setName:(__bridge NSString*)name]; CFRelease(name); 

o una transferencia de puente:

 NSString * name = (__bridge_transfer NSString *)ABRecordCopyValue(person,kABPersonFirstNameProperty); [ssemailvc setName:name]; 

Si está usando MRC:

 CFStringRef name = (CFStringRef)ABRecordCopyValue(person,kABPersonFirstNameProperty); [ssemailvc setName:(NSString*)name]; CFRelease(name); 

La razón por la que está viendo la advertencia es que ABRecordCopyValue devuelve un CFStringRef con +1 retain count .

Tratar

 - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person { [popContactsForm dismissPopoverAnimated:YES]; CFStringRef strLname = ABRecordCopyValue(person, kABPersonLastNameProperty); [ssemailvc setName: (NSString *) strLname]; if(strLname){ CFRelease(strLname); } ABMultiValueRef emails = (NSString *)ABRecordCopyValue(person,kABPersonEmailProperty); if (ABMultiValueGetCount(emails)>0) { [ssemailvc setEmail:(NSString *)ABMultiValueCopyValueAtIndex(emails,0)]; }else [ssemailvc setEmail:@""]; if(emails){ CFRelease(emails); } [peoplePicker dismissModalViewControllerAnimated:YES]; [popEmailForm setPopoverContentSize:CGSizeMake(350.0, 225.0)]; return NO; }