문제

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
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top