Re: Arcs and Bridges
Re: Arcs and Bridges
- Subject: Re: Arcs and Bridges
- From: David Duncan <email@hidden>
- Date: Mon, 17 Oct 2011 09:55:11 -0700
On Oct 15, 2011, at 11:42 PM, Quincey Morris wrote:
> Use '(__bridge_transfer NSString *)'. You're transferring ownership via 'axb' to ownership via 'myString', if that makes any sense.
>
> ARC uses horribly ambiguous terminology here:
This is one of the reasons we added the CFBridgingRetain and CFBridgingRelease functions to wrap the typecasts.
You use CFBridgingRetain to convert an object that is managed via ARC to one that is managed manually, and CFBridgingRelease to do the opposite.
So you write "CFStringRef cfString = CFBridgingRetain(nsString)" to get an owning reference to an NSString as a CFString.
And you write "NSString *nsString = CFBridgingRelease(cfString);" to get an ARC managed reference of a CFString as an NSString.
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden