-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Launch simulator for specific device
- Added --simulator flag to 'exec' and 'simulator open' - Modifies the app's Info.plist to force device
- Loading branch information
Showing
5 changed files
with
124 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env osascript | ||
|
||
(* | ||
Copyright (c) 2012 Jonathan Penn (http://cocoamanifest.net/) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
Chooses a device type from the iPhone Simulator using menu | ||
selection events. | ||
To use, make sure this file is executable, then run from the terminal: | ||
bin/choose_sim_device "iPad (Retina)" | ||
Originally, I tried to do this by editing the Preference file for the | ||
simulator, and it worked under Xcode 4.3, but now it ignores those changes | ||
often enough that I chose to use this menu-selection route. | ||
*) | ||
|
||
on run argv | ||
set simType to item 1 of argv | ||
|
||
activate application "iPhone Simulator" | ||
tell application "System Events" | ||
tell process "iOS Simulator" | ||
tell menu bar 1 | ||
-- Hardware menu bar item | ||
tell menu bar item 5 | ||
-- Hardware menu | ||
tell menu 1 | ||
-- Device menu item | ||
tell menu item 1 | ||
-- Device sub menu | ||
tell menu 1 | ||
click menu item simType | ||
end tell | ||
end tell | ||
end tell | ||
end tell | ||
end tell | ||
end tell | ||
end tell | ||
|
||
-- Need to show the simulator again after changing device, | ||
-- or else the simulator be hidden when launched by instruments | ||
-- for some odd reason. | ||
tell application "System Events" | ||
set visible of process "iOS Simulator" to true | ||
end tell | ||
|
||
end run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters