Pregunta

I'm using nsxml parsing in my iOS, which means that I have to turn off arc. However, adding a contact requires using __bridge which causes a crash using ABRecordCopyCompositeName without arc. How do I go about avoiding using arc but still accomplish checking the address book for a comparable entry?

ABRecordRef thisContact = (__bridge ABRecordRef)record;
//NSString *contact = (__bridge_transfer NSString *)(ABRecordCopyCompositeName(ref));
CFRelease(thisContact);

if (CFStringCompare(ABRecordCopyCompositeName(thisContact), ABRecordCopyCompositeName(pet), 0) == kCFCompareEqualTo){
//this checks if there is a previous contact with that name
¿Fue útil?

Solución

You don't need a __bridge if you're not using ARC. You'll probably need the typecast still i.e. (ABRecordRef) instead of (__bridge ABRecordRef). Here's the definition of __bridge. It's only used as part of ARC.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top