jonathanpenn / ui-screen-shooter

Using UI Automation to automatically generate all screenshots of your iOS app, on different device types, in different locales by running a single command. Hands free.
http://cocoamanifest.net
MIT License
811 stars 61 forks source link

Fix close simulator and add reset simulator #74

Open ehuebner opened 9 years ago

ehuebner commented 9 years ago

I worked with that amazing script and recognized two things:

The close sim function does not work: Simulator application name is "iOS Simulator", not "iPhone Simulator" function _close_sim {

I know, I know. It says "iPhone Simulator". For some reason,

that's the only way Applescript can identify it.

osascript -e "tell application \"iOS Simulator\" to quit" }

I had to delete the app from the simulator to get the new code version in UIAutomation so i reset all simulators before the "_xcode clean build" call by calling my "_reset_all_sim" function: function _reset_all_sim { instruments -s devices \ | grep Simulator \ | grep -o "[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}" \ | while read -r line ; do echo "Reseting Simulator with UDID: $line" xcrun simctl erase $line done }

Attention: If a simulator is running it will not be cleaned. I recommend to call "_close_sim" before "_reset_all_sim" to ensure all simulators are getting cleared.

jonathanpenn commented 9 years ago

I've you'd like to submit a pull request, I'll merge this in.