I'm starting to learn programming with Objective-C and I donβt have much knowledge of C. So, bridge casting in iOS 6 is still a bit confusing for me.
Here is the scenario:
I have an ABRecordID person stored in CoreData as an NSNumber attribute. Later, I would like to access this person directly, so I want to use the ABRecordID person to access contact information using ABAddressBook. Noticed that ABAddressBookGetPersonWithRecordID requires ABRecordID, the following describes how I cast in my code ...
address_book = ABAddressBookCreate(); ABRecordID rec_id = (__bridge ABRecordID)person.record_id;
However, this failed, and I was given incompatible types casting 'int' into 'ABRecordID' (aka 'int') with a __bridge cast .
Already confusing, be that as it may, what would be the appropriate way to transition between ARC types and CF type?
Also, in which case should you use (__bridge retained) instead of (__bridge) ?
source share