didReceiveMemoryWarning - how to differentiate between warning levels
how do I differentiate between the two memory warning levels in didReceiveMemoryWarning ?
Received memory warning. Level=1
Received memory warning. Level=2
I'd like to warn the user what's happening, but only when at level 2 (the more critical). does anyone know h开发者_C百科ow to code this ?
thank you!
Unless you have some means of warning the user without allowing any additional memory to be allocated between the time your app receives the warning and the time the user has responded to the warning and your app has done something about it, then -- no -- you can't reasonably do anything like telling the user about said situation regardless of warning level.
Even if you could tell the user, why would you? Even if they understand what memory is, there isn't much they could do that your app isn't better equipped to just silently do automatically.
When that warning is received, your app should immediately set about releasing memory. This is well documented in the iOS documentation. This is a good start and points to many other bits of reference material.
精彩评论