NativeScript / ios-sim-portable

A Node.js command-line utility to launch an iOS application bundle (.app) in the Xcode iOS Simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't run tns emulate ios --device "iPad Pro (12.9 inch)"

asterizk opened this issue · comments

I can't run tns emulate ios --device "iPad Pro (12.9 inch)"

Doing so results in the following message:
Starting iOS Simulator Unable to find device iPad Pro (12.9 inch). The valid device names are iPhone 5, iPhone 5s, iPhone 6, iPhone 6 Plus, iPhone 6s, iPhone 6s Plus, iPhone 7, iPhone 7 Plus, iPhone SE, iPad Retina, iPad Air, iPad Air 2

Expected result:

  • Starts 12.9" iPad simulator

This error occurs despite 'xcrun simctl list' outputting the 12.9" iPad as an option.

I believe I've tracked the root cause down to the fact that "iPad Pro (9.7 inch)" and the "iPad Pro (12.9 inch)" devices contain parentheses in their names, and the regex that parses the output of 'xcrun simctl list' doesn't expect those parentheses to be there:

var lineRegex = /^ ([^\(]+) \(([^\)]+)\) \(([^\)]+)\)( \(([^\)]+)\))*/;

That regex is contained in the following file: ios-sim-portable-master/lib/simctl.ts

I've got version 1.3.0 of ios-sim-portable. In the meantime I'm working around it by manually adding devices to the device list in my installed copy of simctl.js:

            devices.push({
                            name: 'iPad Pro (9.7 inch)',
                            id: 'F123F133-F175-4FF4-ABA5-4A043EFCA810',
                            fullId: "com.apple.CoreSimulator.SimDeviceType.iPad Pro (9.7 inch)",
                            runtimeVersion: '10.0',
                            state: 'Shutdown'
                        });


            devices.push({
                            name: 'iPad Pro (12.9 inch)',
                            id: '07552BEF-F830-4561-912B-D760B0716935',
                            fullId: "com.apple.CoreSimulator.SimDeviceType.iPad Pro (12.9 inch)",
                            runtimeVersion: '10.0',
                            state: 'Shutdown'
                        });

...right before the return devices; statement.

Obviously this is a big hack and not a solution (the solution would involve fixing that regex), but at the present it allows me to launch my Nativescript app on the 12.9" iPad under emulation, which is pretty important for me because it's the only iOS platform my company actually supports at the moment.

The symptoms look very similar to ios-control/ios-sim#197. Note that aharbick there has a proposed fix for that regex that might be useful here too.

My config:
OS X 10.11.6
Xcode 8.0 (8A218a)
tns --version: 2.3.0
ios-sim-portable: 1.3.0
npm --version: 3.10.8
tsc --version: Version 2.0.3

@enchev iPad Pro 12.9 inch is used to generate the iPad screenshot for the new iTunes Connect screenshot system that uses the largest image in the device family and scales it down;

As it stands, this bug makes it complex to publish new app store apps without having a physical iPad Pro, and without @asterizk 's patch I would have been in a rough spot

Just got rejected from the App store ("Metadata Rejected") because I didn't have screenshots from the iPad Pro 12.9" due to this bug. @asterizk 's patch worked for me too. Thanks!

commented

If you have more recent versions of ios-sim-portable, etc you might need this modified code for the hack:

            devices.push({
                            name: 'iPad Pro (9.7 inch)',
                            id: '21D9848C-A6E7-4D99-81A3-94FD8C49C9CA',
                            fullId: "com.apple.CoreSimulator.SimDeviceType.iPad Pro (9.7 inch)",
                            runtimeVersion: '10.2',
                            state: 'Shutdown'
                        });


            devices.push({
                            name: 'iPad Pro (12.9 inch)',
                            id: '774F9E75-0388-4F69-B7E6-D4F57D1CFDA4',
                            fullId: "com.apple.CoreSimulator.SimDeviceType.iPad Pro (12.9 inch)",
                            runtimeVersion: '10.2',
                            state: 'Shutdown'
                        });

My config:
OS X 10.12.3
Xcode: 8.2.1 (8C1002)
ios-sim-portable: 1.6.1
npm --version: 2.14.7
appbuilder --version: 3.6.7-810