ios-control / ios-sim

Command-line application launcher for the iOS Simulator
Apache License 2.0
1.49k stars 253 forks source link

ios-sim does not work for iPad-Pro for iOS 10 runtime #197

Closed aharbick closed 7 years ago

aharbick commented 7 years ago

Command and results (I've got iOS 10 and 9.3 simulators installed and I can launch the iPad-Pro 9.7 and 12.9 devices in the simulator but this is the result of my command.

bash-3.2$ ios-sim showdevicetypes
iPhone-4s, 9.3
iPhone-5, 9.3
iPhone-5, 10.0
iPhone-5s, 9.3
iPhone-5s, 10.0
iPhone-6, 9.3
iPhone-6, 10.0
iPhone-6-Plus, 9.3
iPhone-6-Plus, 10.0
iPhone-6s, 9.3
iPhone-6s, 10.0
iPhone-6s-Plus, 9.3
iPhone-6s-Plus, 10.0
iPad-2, 9.3
iPad-Retina, 9.3
iPad-Retina, 10.0
iPad-Air, 9.3
iPad-Air, 10.0
iPad-Air-2, 9.3
iPad-Air-2, 10.0
iPhone-7, 10.0
iPhone-7-Plus, 10.0
iPhone-SE, 10.0
Apple-TV-1080p, tvOS 10.0
Apple-Watch-38mm, watchOS 3.0
Apple-Watch-42mm, watchOS 3.0
Apple-Watch-Series-2-38mm, watchOS 3.0
Apple-Watch-Series-2-42mm, watchOS 3.0

Further if I try to install an app into the simulator like so

phonegap run ios --target "iPad-Pro" --emulator

I get this error

No available runtimes could be found for "iPad Pro (12.9-inch)".

Below is the requested version information.

sw_vers

ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G1004

ios-sim --version

5.0.8

xcodebuild -version

Xcode 8.0
Build version 8A218a

xcode-select --print-path

/Applications/Xcode.app/Contents/Developer

gcc --version

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
aharbick commented 7 years ago

I'm pretty sure this is because

xcrun simctl list devices

Is not reporting iPad Pro as this

    iPad Pro (9.7 inch) (94B87E6E-51EA-41BA-BDAD-DDA3246712E3) (Shutdown)
    iPad Pro (12.9 inch) (C0F6C6F5-80EA-497C-86AD-02A5176E1D30) (Shutdown)

And the regexps in simctl/lib/simctl-list-parser.js are not expecting the "(12.9 inch)" in the names for the devices.

aharbick commented 7 years ago

Another problem is that

xcrun simctl list devicetypes

Uses a format for the name of the device

iPad Pro (12.9-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)

I monkeyed around with simctl-list-parser.js over in the simctl wrapper. Doing that I got ios-sim showdevicetypes to work.

Here's the commit in my fork: https://github.com/aharbick/simctl/commit/37028f97d93113fee9ed852a29bd0a321cc0e7c5

I'd submit a PR, but I don't have a good enough sense of the process or the potential impacts elsewhere in the ecosystem.

Let me know how else I can help.

shazron commented 7 years ago

Thanks! evaluating this now in simctl.

shazron commented 7 years ago

Fixed in https://github.com/phonegap/simctl/issues/11 after adding failing tests. I will push a new simctl version and use it in a new ios-sim release

pvadam commented 7 years ago

It still does not show iPad Pro!

$ ios-sim --version
5.0.9
$ xcrun simctl list devicetypes
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
iPhone 7 (com.apple.CoreSimulator.SimDeviceType.iPhone-7)
iPhone 7 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-7-Plus)
iPhone SE (com.apple.CoreSimulator.SimDeviceType.iPhone-SE)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
iPad Air 2 (com.apple.CoreSimulator.SimDeviceType.iPad-Air-2)
iPad Pro (9.7-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--9-7-inch-)
iPad Pro (12.9-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)
Apple TV 1080p (com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p)
Apple Watch - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm)
Apple Watch - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm)
Apple Watch Series 2 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-38mm)
Apple Watch Series 2 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-42mm)
$ ios-sim showdevicetypes
iPhone-5, 10.0
iPhone-5s, 10.0
iPhone-6, 10.0
iPhone-6-Plus, 10.0
iPhone-6s, 10.0
iPhone-6s-Plus, 10.0
iPhone-7, 10.0
iPhone-7-Plus, 10.0
iPhone-SE, 10.0
iPad-Retina, 10.0
iPad-Air, 10.0
iPad-Air-2, 10.0
Apple-TV-1080p, tvOS 10.0
Apple-Watch-38mm, watchOS 3.0
Apple-Watch-42mm, watchOS 3.0
Apple-Watch-Series-2-38mm, watchOS 3.0
Apple-Watch-Series-2-42mm, watchOS 3.0

Did I miss something? The fork aharbick/simctl@37028f9 lists the two iPad Pros also:

$ ios-sim showdevicetypes
iPhone-5, 10.0
iPhone-5s, 10.0
iPhone-6, 10.0
iPhone-6-Plus, 10.0
iPhone-6s, 10.0
iPhone-6s-Plus, 10.0
iPhone-7, 10.0
iPhone-7-Plus, 10.0
iPhone-SE, 10.0
iPad-Retina, 10.0
iPad-Air, 10.0
iPad-Air-2, 10.0
iPad-Pro--9-7-inch-, 10.0
iPad-Pro, 10.0
Apple-TV-1080p, tvOS 10.0
Apple-Watch-38mm, watchOS 3.0
Apple-Watch-42mm, watchOS 3.0
Apple-Watch-Series-2-38mm, watchOS 3.0
Apple-Watch-Series-2-42mm, watchOS 3.0
shazron commented 7 years ago

Looks like Apple is not being consistent in their device type names for the iPad Pros:

== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
iPhone 7 (com.apple.CoreSimulator.SimDeviceType.iPhone-7)
iPhone 7 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-7-Plus)
iPhone SE (com.apple.CoreSimulator.SimDeviceType.iPhone-SE)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
iPad Air 2 (com.apple.CoreSimulator.SimDeviceType.iPad-Air-2)
iPad Pro (9.7-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--9-7-inch-)
iPad Pro (12.9-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)
Apple TV 1080p (com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p)
Apple Watch - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm)
Apple Watch - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm)
Apple Watch Series 2 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-38mm)
Apple Watch Series 2 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-42mm)
== Devices ==
-- iOS 8.2 --
    Resizable iPad (D7465DA6-D5F7-49C2-9DED-29C22AF40E09) (Shutdown) (unavailable, device type profile not found)
    Resizable iPhone (FD05A655-E0D1-4D8A-9D3B-04F84D494F21) (Shutdown) (unavailable, device type profile not found)
-- iOS 8.4 --
    Resizable iPad (163B7304-376C-4AF4-A0B6-88A5A8DE660D) (Shutdown) (unavailable, device type profile not found)
    Resizable iPhone (89B34D5F-C365-44A3-8D75-1369EB36EF49) (Shutdown) (unavailable, device type profile not found)
-- iOS 10.1 --
    iPad Pro (9.7 inch) (C7EC634B-5F7A-41E0-800E-8CE62B367F12) (Shutdown)
    iPad Pro (12.9 inch) (1835A74E-E4F6-4BAD-8000-C8712B642730) (Shutdown)

Note the hyphen in iPad Pro (9.7-inch) in Device Types and the one in Devices. ios-sim filters only those devicetypes that are in the runtimes as well since we need to get the device id.

aharbick commented 7 years ago

Right. Which is (unfortunately) why I had to do this in my commit:

image

shazron commented 7 years ago

The fix here would be for ios-sim to hack this by (pseudocode):

if (device.name.startsWith('iPad Pro')) {
   // replace hyphens with spaces in the name
}
shazron commented 7 years ago

@aharbick great! my patch is essentially the same, although I'm limiting the reach of this hack by the conditional

shazron commented 7 years ago

I'll get a 5.10 patch out asap

shazron commented 7 years ago

Hacking this in ios-sim only, since technicallysimctl is correct in reporting the output

shazron commented 7 years ago

Tested and published https://github.com/phonegap/ios-sim/releases/tag/5.0.10

pvadam commented 7 years ago

Wow! That was fast! And it works, thank you!!

sagrawal31 commented 7 years ago

I updated this release but I still can't see iPad Pro in cordova emulate ios --list but ios-sim showdevicetypes shows the device:

iPhone-5, 10.1
iPhone-5s, 10.1
iPhone-6, 10.1
iPhone-6-Plus, 10.1
iPhone-6s, 10.1
iPhone-6s-Plus, 10.1
iPhone-7, 10.1
iPhone-7-Plus, 10.1
iPhone-SE, 10.1
iPad-Retina, 10.1
iPad-Air, 10.1
iPad-Air-2, 10.1
iPad-Pro--9-7-inch-, 10.1
iPad-Pro, 10.1
Apple-TV-1080p, tvOS 10.0
Apple-Watch-38mm, watchOS 3.1
Apple-Watch-42mm, watchOS 3.1
Apple-Watch-Series-2-38mm, watchOS 3.1
Apple-Watch-Series-2-42mm, watchOS 3.1

Am I missing something?

shazron commented 7 years ago

For cordova issues, try filing an issue at http://issues.cordova.io instead

shazron commented 7 years ago

@sagrawal14 filing a new issue for this, found the problem: #202

sagrawal31 commented 7 years ago

Thanks @shazron. I saw the commit, great!