我刚刚安装了新版本的Xcode / ios6。 viewDidUnload现已折旧。
I just installed the new version of Xcode/ios6. viewDidUnload is now depreciated.
在苹果文档中,
viewDidUnload [。 ..]在iOS 6.0中不推荐使用。在低内存条件下不再清除视图,因此永远不会调用此方法。
viewDidUnload [...] Deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.
但是应用程序的数量正在使用此回调来释放他们的属性,例如:
But numbers of apps are using this callback to release their properties, like :
- (void)viewDidUnload { [super viewDidUnload]; self.recipientButton = nil; self.connectButton = nil; self.infoLabel = nil; }这是发布IBOutlets的最佳做法。
This was the best practice to release your IBOutlets.
所以,第一个问题: iOS 6中这些现有应用会发生什么?它们会泄漏吗?
So, first question: What is going to happen these existing apps in iOS 6? Will they leak ?
和第二个: 发布IBOutlet属性的新推荐方法是什么?在dealloc方法中?
and second one: What is the new recommended way to release an IBOutlet property ? In dealloc method ?
推荐答案对于第一个问题:
您的ViewController将收到didReceiveMemoryWarning方法回调,你可以忽略视图&此方法中的其他组件
Your ViewController will receive didReceiveMemoryWarning method callback and you can nil out the view & other components in this method
参考请参阅WWDC 2012视频会话,了解EVOLLUTION OF VIEW CONTROLLER,如果您还没有(我相信它们仅适用于注册开发人员) ,但不确定)。
For Reference Do Check WWDC 2012 video Session on EVOLUTION OF VIEW CONTROLLER, in case you haven't (I Believe they are available only for registered developers, but not sure).
回答你的第二个。
[对象发布];在dealloc。在释放之前无需为对象指定nil。
[object release]; in dealloc. No need to assign nil to object before releasing.
更多推荐
不再在ios6中调用viewDidUnload
发布评论