iPhone SDK Available Memory

Shaun, Jan 27

The new app we're working on requires at least 14mb or so of free memory to perform a few actions, so we wanted to build in a warning to the user to let them know if their device doesn't have the memory available. Easy right? Not so.

As far as I can tell, there's no method in the Objective-C portion of the iPhone SDK. After a bit of googling, I found this on Apple's mailing list. I've re-worked it and wrapped it in Objective-C to provide easy access.

Here's the code provided as a category to UIDevice:

Now, it's pretty straight forward:

Hope this helps someone!

blog comments powered by Disqus