Closed kelvindart closed 7 years ago
Investigating why it's not showing the new sims.
7 device types are skipped on this line: https://github.com/phonegap/ios-sim/blob/4bbe6b3307b594d9bf78775418fea139e71eabb1/src/lib.js#L330
iPhone 8, 11.0
iPhone 8 Plus, 11.0
iPhone X, 11.0
Apple Watch Series 3 - 38mm, watchOS 4.0
Apple Watch Series 3 - 42mm, watchOS 4.0
Apple TV 1080p, tvOS 11.0
iPad Pro, 9.3
If you run xcrun simctl list devicetypes
you will see the new devices are curiously named (obfuscated?):
== Device Types ==
[..irrelevant device types removed...]
iPhone2017-A (com.apple.CoreSimulator.SimDeviceType.iPhone-8)
iPhone2017-B (com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus)
iPhone2017-C (com.apple.CoreSimulator.SimDeviceType.iPhone-X)
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)
iPad Pro (12.9-inch) (2nd generation) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-)
iPad Pro (10.5-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--10-5-inch-)
Apple TV (com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p)
Apple TV 4K (com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-4K)
Apple TV 4K (at 1080p) (com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-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)
Watch2017 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-38mm)
Watch2017 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-42mm)
which don't correspond to the device names when running xcrun simctl list devices
(this command lists devices per runtime version). I think this is a bug in xcrun simctl list devicetypes
where they did not change the device type names properly. This is apparent in the Apple Watch Series 3 and the new 2017 iPhones, and also the "Apple TV 1080p" for tvOS 11.0.
Also, weirdly the 12.9" iPad Pro is this, just plain iPad-Pro:
iPad Pro (12.9-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)
"iPad Pro, 9.3" is similarly missing in devicetypes since it is now iPad-Pro--9-7-inch-
I hate to do this, but we may have to do a mapping function to match the mismatched devicetypes.
See #219 PR, fixes this issue
Wow - rapid response :) thanks @shazron. I will check it out. How do I raise the bug against Xcode, if this is Apple's doing?
I have just seen you were up late fixing this - thanks for the dedicated effort.
I have installed ios-sim v6.1.1 and am seeing exactly the same behavior as @kelvindart in the OP above.
I am able to launch the simulator from Xcode 9, just not from the cli.
Is there something else that needs to be done on my end to resolve this?
thx
Not enough info. Are you using cordova-ios? There needs to be a platform update since ios-sim is baked in there.
@shazron same probleme here, and yes I'm using cordova-ios. So we have to wait for an platform update…
@jmargolese and @MaxDaten, since updating to ios-sim@6.1.1, it works fine for me.
Make sure to follow @shazron's point on the platform update (i.e. update cordova-ios to the latest, cordova-ios@4.5.0)
First, check which version you are running in your local project:
$ cordova platforms
Then remove it, and add the latest version:
$ cordova platform rm ios
$ cordova platform add ios@4.5.0
This will install the latest, which is compatible with Xcode 9/iOS 11 and sims. Also, follow the point on Cordova's blog (https://cordova.apache.org/announcements/2017/09/08/ios-release.html) about cordova-plugin-console
.
I believe the console is now integrated into the platform to use window.console.log
(is that right @shazron?).
There is a minor issue when running:
$ ios-sim showsdks
But I will open a separate issue for this.
Using 4.5.0 solves the issue for me, but forces me to rollback to use 4.4.0 because of:
duplicate symbol _OBJC_CLASS_$_CDVLogger
I can't tell if 4.5.0 solves the problem. After following @kelvindart 's suggestions, the build command fails with the same problem @KevinBeckers reports above.
@kelvindart it works for me with ios@4.5.0
. Thanks!
All, remove the cordova-plugin-console plugin. See the cordova-ios@4.5.0 blog post: http://cordova.apache.org/announcements/2017/09/08/ios-release.html
@shazron This fixed my issue.
Although my issue isn't quite the same as the original issue, it seems likely related, especially re @shazron's fix.
I get No available runtimes could be found for "iPhone2017-C".
after running cordova run ios --target="iPhone-X"
I've removed cordova-plugin-console. I have
node --version
v7.10.0npm --version
4.2.0Any suggestions?
@jezmck ios-sim has been updated in cordova-ios master branch. Unfortunately you will have to wait for cordova-ios@4.5.1 release (we are starting the vote tomorrow, so prob released next week) or just cd platforms/ios/cordova && npm install ios-sim@latest
in your project
That's amazing, thank you!
I'm running an ionic app.
I am also receiving the No available runtimes could be found for "iPhone2017-C".
when I run ionic cordova run ios --target iPhone-X
I ran the cd platforms/ios/cordova && npm install ios-sim@latest
command and then when attempting to run the app I received this error:
Error: tsconfig: Cannot read file '/platforms/ios/cordova/tsconfig.json': ENOENT: no such file or directory, open '/platforms/ios/cordova/tsconfig.json'.
Any ideas?
@Ericdowney Looks like interesting situation ..
I suggest that you do:
I had similar problem liek you, and for example I got a swift version error in xcode (that I have unsuported swift 2 code ...) then I set in xcode in project config to swift 3.2 and then it started to work. So in the end check generated project in xcode.
Error: tsconfig: Cannot read file '/platforms/ios/cordova/tsconfig.json': ENOENT: no such file or directory, open '/platforms/ios/cordova/tsconfig.json'.
@Ericdowney Make sure you change directories back to the root of your project before running the ionic cordova run
command. I ran into the same error, and running it from the root of the project works. I brought this up to the team (I work at Ionic) to see if we can resolve the need to run this at the root.
If you are getting: No available runtimes could be found
after running: cordova run ios --target="iPhone-#"
Try the approach suggested by @shazron
cd platforms/ios/cordova && npm install ios-sim@latest
I ran: cd platforms/ios/cordova && npm install ios-sim@latest
and this works for iPhone-6-Plus
but it's still failing when I try to emulate iPad-Pro
.
Any suggestions?
Hey @herberzt,
I just tried this and it launched in the simulator just fine. What is the error message you are seeing?
hey @surajpindoria sorry I just now saw this.
when i run : $ phonegap run ios --target "iPad-Pro" --emulator
I get a large thing of output but the main error at the bottom is:
Device type "com.apple.CoreSimulator.SimDeviceType.iPad-Pro" could not be found.
@herberzt, I just tried this again in a different project and was actually able to see the same error as you. But I was able to get rid of it by removing the iOS platform and then re-adding it. Make sure you are using the latest version, cordova platform add ios@latest
.
@surajpindoria okay I will give this a try. Thank you.
@surajpindoria I took your guidance and did the following:
$ rm -rf platforms/ios
$ phonegap platform add ios@latest
$ bin/clean-build.sh
which runs a bunch of commands and essentially gets cocopods in place etc.
went to go run the simulator again and I'm still getting the same error message.
Hmmm, are you able to deploy to the iPad Pro emulator directly from Xcode? You can open your project in Xcode by running open <project-dir>/platforms/ios/<project-name>.xcworkspace
.
@herberzt Just noticed something on my machine that could explain why you are not able to launch the iPad Pro emulator. Can you run ios-sim showdevicetypes
. On a machine using Xcode 9.0 I see an option for just plain iPad Pro
. But on another that is using Xcode 9.0.1 I do not see it, but instead see iPad-Pro--10-5-inch-
and iPad-Pro--12-9-inch---2nd-generation-
.
This could explain why you are not able to launch the emulator.
Had this issue today, after updating to ionic 3.19.0. Using the approach suggested by @shazron worked out
cd platforms/ios/cordova && npm install ios-sim@latest; cd ../../../
when I run ionic cordova build ios --prod. I have a error
cordova build ios Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
[ERROR] An error occurred while running cordova build ios (exit code 1).
how to handle this ?
@pangjianfeng this is not a Cordova issue tracker. Looks like you need to install the full Xcode and for example put it in /Applications
. Then sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
@jezmck ios-sim has been updated in cordova-ios master branch. Unfortunately you will have to wait for cordova-ios@4.5.1 release (we are starting the vote tomorrow, so prob released next week) or just
cd platforms/ios/cordova && npm install ios-sim@latest
in your project
Thank you saved my day.
Expected behavior
To be able to deploy to the iOS simulator when Xcode 9 is installed with the iOS 11 SDK, with the ability to select the additional simulators from the list.
Actual behavior.
When I try to run
cordova emulate ios
without specifying a default device, I receive the following error:Despite there being default simulators installed, it appears like it is not selecting the first relevant simulator, instead, just whatever is at the top of the list.
If I run
ios-sim showdevicetypes
, I am returned the following list, which is omitting the new simulators (iPhone 8, iPhone 8 Plus and the iPhone X), and has the Apple-Watch listed at the start (which, as explained below, is now the default):If I then run
ios-sim start
, it states:I expect, because of this, it's trying to deploy the Cordova app to the Apple Watch, hazard a guess?
If I do specify an iOS emulator to deploy to, I receive the following:
Steps to reproduce the problem
As above (assuming Cordova and ios-sim are installed).
cordova start SimApp && cd SimApp
cordova emulate ios --target="iPhone-7"
System Specs
Please run the commands below in your Terminal.app and include it in the issue. Check when done and include results below.
1. system_profiler SPSoftwareDataType:
2. ios-sim --version:
3. xcodebuild -version:
4. xcode-select --print-path:
5. node --version:
6. npm --version: