Easier low memory warning simulator testing with keyboard shortcuts
It’s important to test any iPhone/iPad app under low memory conditions to ensure that any objects in other view controllers or views that are required are still there after the warning. The simulators have a “Simulate Memory Warning” feature which is very helpful for debugging, but it’s still pretty far away from real-world usage to pause, mouse up to the menu, select the warning, and then see what happens. A low memory warning could have a different result if it arrives in the middle of an ongoing event (while something asynchronous is still going on, or during an animation for instance) instead of a few seconds later.
[politepix-blog-inline-text-ad]
Which is why it can be helpful to make a keyboard shortcut for sending a warning. Go to the System Preferences>Keyboard>Application Shortcuts preference pane, click the “+” button, select application “Other” and then navigate to the iPhone Simulator under /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/, and then enter “Simulate Memory Warning” for the menu item and Command-1 for the shortcut. When testing in the simulator, interact with the mouse or trackpad with one hand and invoke memory warnings with the other at the same time. If you’re a lefty, Command-0 should work.
Greatly appreciated tip! Been looking for a slick solution like this for a while.
Hi Adam, glad you found it helpful.
Thank you. Just what I wanted.
It’s a tragedy that above method is no longer available in 4.3.1 xcode (lion). cause ‘iPhone Simulator.app’ located in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app , and we can not access inside of Xcode.app at Application Shortcuts preference pane.
Is there anyone who help me?
Wow, that is annoying. I’ll give it some thought.
If you symlink the iOS Simulator to be in the Applications folder this will work:
ln -s /Applications/Xcode.app/Contents/Applications/iOS\ Simulator.app /Applications/iOS\ Simulator.app
Nice, thank you tupakapoor for the info — hope this helps others.