Launch a specific Hardware version of iOS simulator using instruments command line utility

末鹿安然 提交于 2019-11-30 04:50:24

Since Xcode 5.1 Instruments supports specifying the simulator hardware type and iOS version from the command line.

instruments -w help

The command above will give you a list about the available hardvare-iOS combinations. On my machine thats are:

iPhone - Simulator - iOS 6.1
iPhone - Simulator - iOS 7.1
iPhone Retina (3.5-inch) - Simulator - iOS 6.1
iPhone Retina (3.5-inch) - Simulator - iOS 7.1
iPhone Retina (4-inch) - Simulator - iOS 6.1
iPhone Retina (4-inch) - Simulator - iOS 7.1
iPhone Retina (4-inch 64-bit) - Simulator - iOS 6.1
iPhone Retina (4-inch 64-bit) - Simulator - iOS 7.1
iPad - Simulator - iOS 6.1
iPad - Simulator - iOS 7.1
iPad Retina - Simulator - iOS 6.1
iPad Retina - Simulator - iOS 7.1
iPad Retina (64-bit) - Simulator - iOS 6.1
iPad Retina (64-bit) - Simulator - iOS 7.1

You can specify the hardware and iOS version also with -w flag. Example:

instruments -w "iPad Retina - Simulator - iOS 7.1" -t ...

Note that -w flag must come at the start of the command line, before any other flags, otherwise you get strange errors.

I have found this information at: http://cocoamanifest.net/articles/2014/03/ui-screen-shooter-now-simpler-and-more-robust-since-xcode-5-1.html

Using Instruments 5.0 (relate to Xcode 5.0):

  1. click the small "i" icon to the right of "Automation" in the upper left part of the window
  2. underneath "Target", click on the name of your app
  3. in the pop-up menu, select "Edit Active Target" in the pop-up window,
  4. click the "Options" menu, and underneath "Simulator Configuration" select the device to simulate and iOS version.

If you don't see a particular iOS version, then you need to add that simulator in Xcode:

  1. Xcode menu, Preferences...
  2. Downloads tab
  3. Click the down-arrow next to the version of iOS simulator you want to install

PS: I created some awesome screenshots, but stackoverflow won't let me post them. boo.

Have you tried iOS-Sim https://github.com/phonegap/ios-sim ? This gives you some extra options when working with the simulator from cmd. The Version is one of these.

If you can select it on the UI, you should be able to achieve the same result using applescript. This is an example of how to change the Device on applescript: https://gist.github.com/Reflejo/9537281

tried something like this?

xcrun instruments -v -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate ~/Library/Application\ Support/iPhone\ Simulator/6.1/Applications/00C7521A-92D9-4627-BB1D-2CD7CA605B9B/Mobile\ EMR.app -e UIASCRIPT /Volumes/Data/SoftServe/Projects/mEMR/imHealth/Testing/testUI.js -e UIARESULTSPATH /Volumes/Data/SoftServe/Projects/mEMR/imHealth/Testing/results.txt
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!