Problem:
You spend a lot of time and effort building your app, writing countless view controllers. You think it’s near perfect.
Then one of your beta testers (or customers, or app reviewers) finds a problem. You look into it and realize that it only happens after a low memory pressure warning.
You should have written your viewDidLoad to handle getting called after a low memory pressure warning, but you didn’t.
Wouldn’t it be great if you were forced to write your viewDidLoad implementation with low memory situations in mind? After all, out in the wild on real world devices, it’s very likely that sooner or later every single one of your view controllers will have to handle this.
Solution:
Add this code to your project and have your view controller inherit from BaseViewController instead of UIViewController. Every time viewWillAppear is called, the simulator will force a low memory warning.
iDev Recipes
You spend a lot of time and effort building your app, writing countless view controllers. You think it’s near perfect.
Then one of your beta testers (or customers, or app reviewers) finds a problem. You look into it and realize that it only happens after a low memory pressure warning.
You should have written your viewDidLoad to handle getting called after a low memory pressure warning, but you didn’t.
Wouldn’t it be great if you were forced to write your viewDidLoad implementation with low memory situations in mind? After all, out in the wild on real world devices, it’s very likely that sooner or later every single one of your view controllers will have to handle this.
Solution:
Add this code to your project and have your view controller inherit from BaseViewController instead of UIViewController. Every time viewWillAppear is called, the simulator will force a low memory warning.
iDev Recipes
Comments
Post a Comment