iOS Simulator not refreshing with Cordova (PhoneGap)? Read this.

About a month or two ago I noticed something odd with my Cordova tests. I’d fire off a call to the iOS simulator by doing cordova emulate ios. The first time, it worked fine. But as I edited I noticed something odd. Subsequent calls to the emulator would end up in a blank screen in the emulator. If I watched carefully, I’d see my app load for a split second before going black.

Apparently, this is a bug with ios-sim, the command line tool used to talk to the simulator. If you know to check out the GitHub repo for it you will see a tip suggesting this command to fix it: killall launchd_sim

This works like a charm, and since I normally just “edit, alt-tab to terminal, click up, enter” in my dev cycle, I just switched my command to this: killall launchd_sim && cordova emulate ios