Thursday, October 4, 2012 [Tweets] [Favorites]

__unsafe_unretained

Mark Dalrymple:

There are some classes that can’t have weak references assigned to them, such as NSImage and NSFont (and others). In OS X 10.7 you can’t have weak references to those, and other classes like NSWindow or NSWindowController (and others), due to legacy or technical details, such as a custom retain and release implementation (Thanks to Mike Ash for the hint as to why some of these classes are off-limits). But there are times you might want to point to them and not create a strong reference. Perhaps it’s to break a retain cycle. You’d use __unsafe_unretained for those.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment