Launch a specific Hardware version of iOS simulato

2020-02-23 05:34发布

I am using UIAutomation provided by Apple -> Xcode -> instruments. I have my Javascripts and the whole automation using instruments command line infrastructure running up.

I got an additional task of running automation on previous versions of simulator (iOS 6.0 , 5.1, 5.0, 4.3.2) to provide better coverage.

But i do not know a way to specify which version of iOS simulator to choose from. by default it always chooses the lates iOS simulator.

I have tried the following things:

  1. Specifying the path where the simulator is kept which includes the version path of simulator.
  2. Making a custom Automation template trace and trying to use it.
  3. Changed the default version of iOS simulator using defaults write com.apple.simulator utility.

5条回答
别忘想泡老子
2楼-- · 2020-02-23 06:16

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.

查看更多
男人必须洒脱
3楼-- · 2020-02-23 06:20

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

查看更多
Root(大扎)
4楼-- · 2020-02-23 06:25

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
查看更多
淡お忘
5楼-- · 2020-02-23 06:28

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.

查看更多
虎瘦雄心在
6楼-- · 2020-02-23 06:29

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

查看更多
登录 后发表回答