Repository navigation
Description
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: /usr/local/lib/node_modules/nativescript/node_modules/ios-sim-portable/lib/simctl.js.
I guess that means it's a problem with the ios-sim-portable module. I've got version 1.3.0 of it. I will file an issue with that project. In the meantime I'm working around it by manually adding devices to the device list in 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 that's 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.
Feel free to close this if issues in dependencies shouldn't be filed here. I just thought I might file it because it manifested itself while I was using 'tns' and it might help someone else out.
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
Activity
asterizk commentedon Oct 14, 2016
Looks a lot like this: ios-control/ios-sim#197
davecoffin commentedon Dec 22, 2016
@asterizk Do you need to reinstall nativescript after you add your workaround?
asterizk commentedon Dec 22, 2016
No, I don't think so, but, for what it's worth, I haven't tried it in a couple of months so it may no longer work... ? What are you seeing?
biziosan commentedon Feb 8, 2017
Hi, I've just installed NativeScript.
iPad Air 2 is detected as a simulated device. The demo app starts just fine. iPad Pro (both types) is not detected.
grasshoppermouse commentedon Feb 14, 2017
iPad Pro also not detected on my setup. Annoying because the App submission process requires screenshots from the 12.9" Pro, and I just got a "Metadata Rejected" from Apple due to lack of accurate screenshots from that device.
nraboy commentedon Feb 20, 2017
Any news on this? Apple won't let me submit my app without iPad Pro pictures, but I can't simulate on iPad Pro.
rosen-vladimirov commentedon Feb 20, 2017
@nraboy , @grasshoppermouse you can change the device type of your simulator by executing the following steps:
Hardware->Device->iOS 10.1->iPad Pro (12.9 inch)tns run ios- CLI will respect the already running emulator.Hoep this helps.
nraboy commentedon Feb 20, 2017
That does not work @rosen-vladimirov. It never deploys the app even with the correct simulator running. Works for every simulator except iPad Pro.
grasshoppermouse commentedon Feb 20, 2017
@nraboy is correct: switching simulators first doesn't help; files still don't transfer and the app doesn't launch. I used the hack of @asterizk, and then it seemed to work. However, the simulator that started running was the
iPad Pro(without the parentheses), which I believe is only available iniOS 9(not at work so I can't check). It turns out this has the same screen size as theiPad Pro (12.9 inch). I submitted screen shots to the app store from theiPad Pro, and the app was approved.nraboy commentedon Feb 20, 2017
@grasshoppermouse it didn't work for me.
I'm pretty bummed right now because I worked hard on my application and Apple won't let me submit until I get iPad Pro images.
@rosen-vladimirov any ideas here?
tjvantoll commentedon Feb 20, 2017
I confirmed this as well. Even if you launch the 12.9 emulator you are unable to deploy to it from the {N} CLI.
As a temporary workaround until this problem can be addressed, your best bet is running your app on the “iPad Retina”, which gives you 1536 x 2048 screenshots, and then manually upsizing those screenshots to the required 2048 x 2732 size. Not ideal because you lose a bit of quality, but I’ve taken this approach before and had apps accepted.
rosen-vladimirov commentedon Feb 20, 2017
@nraboy , @grasshoppermouse , @tjvantoll sorry for this issue 😿
I'll raise it's priority and will try to take a look at the issue by the end of the week. Meanwhile can you provide the following information, while the iPad simulator is running:
As a workaround you may try the following:
This will build your application for iOS Simulator. Find the output in your
platforms/iOS/<project name>/build/emulator/<project name>.app(the path may vary on your environment).After that, make sure your iOS Simulator (the problematic iPad one) is running and execute:
From this line get the identifier of the booted device.
After that try the following:
12 remaining items
pkoleva commentedon May 4, 2017
Hey, @asterizk ,
The main issue is that so far we've used other logic for starting simulators/deploying on them. With the changes ( in our 3.0.0 release and the RC before that) we weren't sure what will be useful to you, our users, so for iOS we haven't decided how to start simulators by their name. You can start any existing simulator by id (
tns run ios --device <device identifier>), which you can check by executingtns devices ios --available-devices. Hope this helps :)pkoleva commentedon Jul 14, 2017
Related to #1548
We still need to figure out the proper way to start specific simulators
Support for getting device by name and sdk
Support for getting device by name and sdk
Support for getting device by name and sdk
dtopuzov commentedon Apr 25, 2018
Fixed in 4.0.1 RC (4.0.1-2018-04-23-11424).
Now you can do things like this:
To see all available devices and sdks run this: