Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Normal casting vs bridge casting in Objective - C

What is the different between,

(CFDataRef) data

&

(__bridge CFDataRef) data

Xcode asked me to change it to bridge. Is that because of ARC?

like image 970
TeaCupApp Avatar asked May 31 '12 13:05

TeaCupApp


1 Answers

Yes, ARC needs to be given instructions when you cast between toll-free bridged types. In this case __bridge tells ARC to do nothing, so this will behave the same as the previous standard cast.

You can read the Transitioning to ARC Release Notes for more details on the different ways to do bridging casts.

like image 134
Mike Weller Avatar answered Oct 19 '22 22:10

Mike Weller