Normal casting vs bridge casting in Objective - C

隐身守侯 提交于 2019-12-30 00:56:07

问题


What is the different between,

(CFDataRef) data

&

(__bridge CFDataRef) data

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


回答1:


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.



来源:https://stackoverflow.com/questions/10834522/normal-casting-vs-bridge-casting-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!