How to automatically reset iPhone simulator on assembly

After moving a few JSON files from the root directory of the app to the directory structure (also in the app bundle), the app continued to work as if the files had remained in their previous location. After repeatedly scratching my head and doing a clean build, I remembered that the iPhone simulator needs to be cleaned to get rid of these files in old places.

It would be nice to be able to force reset the simulator on every build. Clean-slate mode if you like. Could this be hacked in any way? Any ideas?

+3


source to share


2 answers


You can add "New Run Script Action" to "Prerequisites" for the "Run" step of your circuit to run AppleScript, which will reset the simulator.

First install the shell to / usr / bin / osascript



Then enter the following in the "type a script" field:

#!/usr/bin/env osascript

tell application "iPhone Simulator"
    activate
end tell

tell application "System Events"
    tell process "iPhone Simulator"
        tell menu bar 1
            tell menu bar item "iOs Simulator"
                tell menu "iOs Simulator"
                    click menu item "Reset Content and Settings…"
                end tell
            end tell
        end tell
        tell window 1
            click button "Reset"
        end tell
    end tell
end tell

      

+7


source


In Yosemite + iOS Simulator 8.3, it worked when I changed Vic's "iPhone Simulator" and "iOS Simulator" lines to "iOS Simulator".



0


source







All Articles