On Fri, Nov 18, 2011 at 1:47 PM, Charles Srstka <cocoa...@charlessoft.com> wrote: > How is one supposed to manage this? You can easily get the array of the > top-level objects, but since ARC doesn’t let you send -release to them, it > doesn’t help much. The only ways I can think of to avoid leaking are to do > silly things like performSelector:NSSelectorFromString(@“release”) or to wrap > the NSNib-using code in a non-ARC source file. Neither seems ideal. > > What’s the best way to deal with something like this?
>From the recently-revised Resource Programming Guide: "If the File’s Owner is not an instance of NSWindowController or NSViewController, then you need to decrement the reference count of the top level objects yourself. With manual reference counting, it was possible to achieve this by sending top-level objects a release message. You cannot do this with ARC. Instead, you cast references to top-level objects to a Core Foundation type and use CFRelease. (If you don’t want to have outlets to all top-level objects, you can use the instantiateNibWithOwner:topLevelObjects: method of the NSNib class to get an array of a nib file’s top-level objects.)" http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW10 --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com