TeaCupApp
TeaCupApp

Reputation: 11452

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?

Upvotes: 24

Views: 13227

Answers (1)

Mike Weller
Mike Weller

Reputation: 45598

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.

Upvotes: 30

Related Questions