I\'m confused with bridge
and bridge_transfer
, is this correct?
-(void)getData{
ABAddressBookRef addressBook = ABAddressBookCreate(
If you have automatic-reference-counting (ARC) turned on, the code is correct.
There are two __bridge_transfer
in your statements. As a result, the ownership of created CFObjects will be transferred to NSObjects. If you have ARC turned on, they will be freed up automatically. If you used __bridge
instead for these 2 statements, you will need to explicitly call CFRelease
to release CFObjects created by the *Copy
API.
The __bridge
statement is also correct. Because you are referencing an NSObject in CF API. You are not transferring ownership, so that ARC will free it up.