Nib unloading and ARC
Nib unloading and ARC
- Subject: Nib unloading and ARC
- From: Jonathan Mitchell <email@hidden>
- Date: Mon, 15 Sep 2014 23:00:27 +0100
I am using a NIB template, loading the same nib repetitively with a different owner each time (a non NSViewController subclass).
In the nib there is an NSValueBinding binding to the owner say: self.itemValue.
This all works fine.
However, nib owner items are not being dealloc’d.
This behaviour only occurs if the nib contains a binding to self.
Keary Suska has been down this route pre ARC : http://www.cocoabuilder.com/archive/cocoa/181029-proper-way-to-unload-loaded-nib-bindings.html
Nib top level objects seem to have an extra retain.
The docs recommend the following [topLevelObjs makeObjectsPerformSelector:@selector(release)];
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW8
However I haven’t been able to get this explicit release approach to work under ARC.
Just calling CFRelease((__bridge CFTypeRef)(item)) on each of the top level objects doesn’t work.
Or should I refactor to make each NIB owner an NSViewController instance?
Thanks
Jonathan
_______________________________________________
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