您应该使用AppleScript更改com.apple.iphonesimulator.plist
中的SimulateDevice
的值。
这是一个example这样做后提示用户选择所需的设备类型。您可以修改它以从命令行读取值或使用"iPhone (Retina)"
作为默认值。
下面的脚本模拟器装置改变成通过命令行的值:
on run argv
set selectedDevice to item 1 of argv as string
set thePListFolderPath to path to preferences folder from user domain as string
set thePListPath to thePListFolderPath & "com.apple.iphonesimulator.plist"
tell application "System Events"
tell property list file thePListPath
tell contents
set value of property list item "SimulateDevice" to selectedDevice
end tell
end tell
end tell
end run
而且可以从终端使用命令osascript
执行它:
osascript myScript.scpt "iPhone (Retina)"
或者
osascript myScript.scpt "iPhone"
编辑
可以修改脚本,使它在默认情况下启动的Retina模拟器:
set selectedDevice to "iPhone (Retina)"
set thePListFolderPath to path to preferences folder from user domain as string
set thePListPath to thePListFolderPath & "com.apple.iphonesimulator.plist"
tell application "System Events"
tell property list file thePListPath
tell contents
set value of property list item "SimulateDevice" to selectedDevice
end tell
end tell
end tell
最后请注意,更改"SimulateDevice"
只需要在一个新的模拟器启动的效果。
来源
2012-03-06 11:55:50
sch
是您的** ** xcodebuild联编命令实际上在启动模拟器中的应用程序?告诉我如何! – 2012-04-09 19:05:59
请参阅https://gist.github.com/1365687和http://lifeandcode.net/2011/12/automated-ios-jenkins-builds-with-application-tests-and-core-data/和http:/ /longweekendmobile.com/2011/04/17/xcode4-running-application-tests-from-the-command-line-in-ios/对于我所关注的一些参考文献 – Roger 2012-04-10 12:54:26