Hey, here’s a handy tip for scheduling low memory warnings for your debugging pleasure: use AppleScript!
LOW MEMORY WARNING BOMBARDMENT TOOL
I wanted to share a tool that I use in as part of checking an app for behaving correctly under low memory warnings, to the extent that is possible to do so using the Simulator. It’s an Applescript that just sends a low memory warning to the simulator every second or so, so you can go through every function of your app while debugging and see if a low memory warning ever causes a crash…
It’s simply triggering the ‘Simulate Memory Warning’ menu item repeatedly for you … but hey, there’s been times that we wanted to simulate low memory conditions whilst in the midst of an action that required our full attention, and it never occurred to us to whip up a script like this…
h/t: @politepix!
UPDATE:
Note in the comments that there’s an unofficial API call “_performMemoryWarning” you can use for the same purpose in code:
[NSTimer scheduledTimerWithTimeInterval:1.0 target:[UIApplication sharedApplication] selector:@selector(_performMemoryWarning) userInfo:nil repeats:YES];
That will work nicely on the device no doubt. Just don’t forget to remove it before submitting!
UPDATER:
Here’s a programmatic way to do this in the Simulator:
Debugging Magic: Auto Simulate iOS Memory Warnings
APR
Pingback: Open the Simulator sandbox folder of the app you just built and ran : Politepix