Reputation: 1226
I am having trouble converting a CFDataRef
into NSData
whilst using ARC
. I am using the __bridge_transfer
OR __bridge
cast but it is not working. Could anyone suggest me some other way of casting this two types.
I get the following error
Automatic Reference Counting Issue: Incompatible types casting 'CFDataRef *' (aka 'const struct __CFData **') to 'NSData *' with a __bridge cast
Upvotes: 1
Views: 4900
Reputation: 10065
NSData *my_nsdata = (__bridge_transfer NSData*)my_cfdata; // -1 on the my_cfdata
or
NSData *my_nsdata = (__bridge NSData*)my_cfdata; // no adjustment of retain counts.
From my blog post here:
http://amattn.com/2011/12/07/arc_best_practices.html
Upvotes: 6