Our Flying Friends

Halle's latest posts

Easier low memory warning simulator testing with keyboard shortcuts

28 February
If you’re interested in this, you might also enjoy checking out OpenEars, Politepix’s free iOS SDK for doing offline speech recognition without using the network, now featuring the ability to generate rules-based recognition grammars dynamically at runtime!

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.


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.

Tags: , , ,

7 Responses to “Easier low memory warning simulator testing with keyboard shortcuts”

  1. Adam McDonald March 11, 2010 at 2:01 am #

    Greatly appreciated tip! Been looking for a slick solution like this for a while.

  2. Halle March 20, 2010 at 8:39 am #

    Hi Adam, glad you found it helpful.

  3. AD April 17, 2010 at 6:24 pm #

    Thank you. Just what I wanted.

  4. Carl March 28, 2012 at 2:18 am #

    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?

  5. Halle March 28, 2012 at 4:50 pm #

    Wow, that is annoying. I’ll give it some thought.

  6. tupakapoor July 16, 2013 at 7:46 pm #

    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

  7. Halle July 16, 2013 at 7:50 pm #

    Nice, thank you tupakapoor for the info — hope this helps others.