Reputation: 11728
I want to support both users running iOS5 and iOS6. But for instance UIViewController
's method -viewDidUnload
is deprecated in iOS6. So how would I use it for users running iOS5, but not for users running iOS6?
Upvotes: 1
Views: 945
Reputation: 7563
while it is indeed okay to continue to have the call to viewDidUnload
…
the information from the WWDC talks on this is that you should not only not have viewWillUnload
and viewDidUnload
for iOS6 situations, but that you should just go ahead and remove it for code that will be used for both iOS 5 and iOS 6.
the justification given by the apple dude narrating the WWDC slide presentation is that apple did some amount of study, and concluded it solved a whole class of crashers that were avoidable, and dealt only w/tiny bits of memory.
the recommendation is that anything that is currently in one of these that's absolutely necessary to your app should probably be appearing in viewDidDisappear:animated: or in dealloc (for large shared stuff that needs to give back memory), and that there will be many cases where neither is necessary.
(not an advocate, just relaying what i learned from the WWDC material on the subject …)
Upvotes: 1
Reputation: 57060
You can continue having this method in your code, it will just not be called. If you really wish to have it called, you can invoke it in didReceiveMemoryWarning
. In fact, move the code there for old iOS as well.
Other changes that might interest you are related to rotation. You can implement both the new iOS6 methods as well as keep the old ones, and they will not interfere with each other.
Upvotes: 6