Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No virtual devices found - Ionic Cordova Emulate iOS

I am trying to emulate my Ionic app in iOS but when I run ionic cordova emulate ios I get an error:

No target specified for emulator. Deploying to undefined simulator
Device type "com.apple.CoreSimulator.SimDeviceType.undefined" could not be found.

It seems that even though there are emulators available on my OSX, Ionic can't access them for some reason. Why are there no devices found in Ionic when there are clearly devices that can be run elsewhere? Could this be an issue with env vars?

For reference: ionic info:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    ios-sim : 7.0.0
    Node    : v9.1.0
    npm     : 6.0.0
    OS      : macOS High Sierra
    Xcode   : Xcode 9.4.1 Build version 9F2000

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

When I run ionic cordova emulate ios --list I get the following output:

Available ios virtual devices:

However, when I run ios-sim showdevicetypes I get:

Apple-Watch-38mm, watchOS 4.3
Apple-Watch-42mm, watchOS 4.3
Apple-Watch-Series-2-38mm, watchOS 4.3
Apple-Watch-Series-2-42mm, watchOS 4.3
Apple-Watch-Series-3-38mm, watchOS 4.3
Apple-Watch-Series-3-42mm, watchOS 4.3
iPhone-5s, 11.4
iPhone-6, 11.4
iPhone-6-Plus, 11.4
iPhone-6s, 11.4
iPhone-6s-Plus, 11.4
iPhone-7, 11.4
iPhone-7-Plus, 11.4
iPhone-8, 11.4
iPhone-8-Plus, 11.4
iPhone-SE, 11.4
iPhone-X, 11.4
iPad-Air, 11.4
iPad-Air-2, 11.4
iPad--5th-generation-, 11.4
iPad-Pro--9-7-inch-, 11.4
iPad-Pro, 11.4
iPad-Pro--12-9-inch---2nd-generation-, 11.4
iPad-Pro--10-5-inch-, 11.4
Apple-TV-1080p, tvOS 11.4
Apple-TV-4K-4K, tvOS 11.4
Apple-TV-4K-1080p, tvOS 11.4

And running xcrun simctl list gives:

== 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 8 (com.apple.CoreSimulator.SimDeviceType.iPhone-8)
iPhone 8 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus)
iPhone SE (com.apple.CoreSimulator.SimDeviceType.iPhone-SE)
iPhone X (com.apple.CoreSimulator.SimDeviceType.iPhone-X)
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 (5th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--5th-generation-)
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-)
iPad (6th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--6th-generation-)
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)
Apple Watch Series 3 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-38mm)
Apple Watch Series 3 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-42mm)
== Runtimes ==
iOS 11.4 (11.4 - 15F79) - com.apple.CoreSimulator.SimRuntime.iOS-11-4
tvOS 11.4 (11.4 - 15L576) - com.apple.CoreSimulator.SimRuntime.tvOS-11-4
watchOS 4.3 (4.3 - 15T212) - com.apple.CoreSimulator.SimRuntime.watchOS-4-3
== Devices ==
-- iOS 11.4 --
    iPhone 5s (68553C20-B109-4807-B20C-E93006B8F214) (Shutdown)
    iPhone 6 (9B230488-BC8B-4947-AC2B-3B8245878625) (Shutdown)
    iPhone 6 Plus (028C9FB4-4179-4772-AC96-9AEC9F447859) (Shutdown)
    iPhone 6s (BFBFF883-1207-4049-851B-DDFF15D7A7D5) (Shutdown)
    iPhone 6s Plus (6030E33B-DE97-41A6-A961-6C05DEA2EA34) (Shutdown)
    iPhone 7 (0F1EE195-BB50-44D3-B87C-DB914196BB68) (Shutdown)
    iPhone 7 Plus (42FDB489-30D3-4BEE-82F1-D6BCA84019F2) (Shutdown)
    iPhone 8 (62895939-A322-4F3D-8D4E-8D8F3F44B98E) (Shutdown)
    iPhone 8 Plus (79D7D0A1-03CE-425D-A714-13CE8E62BCB3) (Shutdown)
    iPhone SE (82AC6B87-D98E-46A2-BE34-7F148F179796) (Shutdown)
    iPhone X (FEA0BBCA-91C3-4EE3-A49A-7EE2BC4382A4) (Shutdown)
    My-iPhoneX (A2E78F04-CB1B-4BCE-8BF3-8EA1B14930E5) (Shutdown)
    iPad Air (6F05FAB3-7094-485E-B518-CE6EC1D46D54) (Shutdown)
    iPad Air 2 (2A075B9A-35B3-410D-8D18-308A94F49F1D) (Shutdown)
    iPad (5th generation) (879A193F-2AF3-4446-BB63-095AE6C9C3E6) (Shutdown)
    iPad Pro (9.7-inch) (025D91DC-43CE-4497-A672-B57857BF6E68) (Shutdown)
    iPad Pro (12.9-inch) (2D1C41EA-5F2E-493F-98C8-29FCCDB35D0F) (Shutdown)
    iPad Pro (12.9-inch) (2nd generation) (96467014-EDC9-47EE-84FE-29AB7817B742) (Shutdown)
    iPad Pro (10.5-inch) (47BEFF82-F240-4105-868D-CA4C8EE3BF29) (Shutdown)
-- tvOS 11.4 --
    Apple TV (E3696606-A26C-4BCE-9CC3-1DC99B148ED3) (Shutdown)
    Apple TV 4K (087290EA-40C9-4EEC-8A80-9D0A92378FA5) (Shutdown)
    Apple TV 4K (at 1080p) (71014E88-3FEF-450A-B315-3C224271401A) (Shutdown)
-- watchOS 4.3 --
    Apple Watch - 38mm (7914DF5F-9810-4995-908F-1BABBAE02670) (Shutdown)
    Apple Watch - 42mm (A335D9E6-7974-45F6-B47D-3747FA9BD09E) (Shutdown)
    Apple Watch Series 2 - 38mm (7FBCB06A-EE99-4C8F-BDD2-870EC5275EF0) (Shutdown)
    Apple Watch Series 2 - 42mm (806DDCC1-588A-455D-AA1A-16F5E5931077) (Shutdown)
    Apple Watch Series 3 - 38mm (DF16B352-301E-4221-81CA-2869A1F9B527) (Shutdown)
    Apple Watch Series 3 - 42mm (85C06E5F-3E1A-4BC4-AECB-4EA0C88D8F09) (Shutdown)
== Device Pairs ==
BE73638A-71E6-41F2-A1EA-3372E898F1B0 (active, disconnected)
    Watch: Apple Watch Series 2 - 38mm (7FBCB06A-EE99-4C8F-BDD2-870EC5275EF0) (Shutdown)
    Phone: iPhone 7 (0F1EE195-BB50-44D3-B87C-DB914196BB68) (Shutdown)
E17C2241-7367-4F02-AC44-54542EDBC936 (active, disconnected)
    Watch: Apple Watch Series 2 - 42mm (806DDCC1-588A-455D-AA1A-16F5E5931077) (Shutdown)
    Phone: iPhone 7 Plus (42FDB489-30D3-4BEE-82F1-D6BCA84019F2) (Shutdown)
A463C9D5-E753-46F8-9493-D1A3E3BDCAA1 (active, disconnected)
    Watch: Apple Watch Series 3 - 38mm (DF16B352-301E-4221-81CA-2869A1F9B527) (Shutdown)
    Phone: iPhone 8 (62895939-A322-4F3D-8D4E-8D8F3F44B98E) (Shutdown)
7A7B90CE-9B4F-41A6-8721-C7457E9F4A4E (active, disconnected)
    Watch: Apple Watch Series 3 - 42mm (85C06E5F-3E1A-4BC4-AECB-4EA0C88D8F09) (Shutdown)
    Phone: iPhone 8 Plus (79D7D0A1-03CE-425D-A714-13CE8E62BCB3) (Shutdown)

There are lots of bits of code here because it requires output logs.

like image 384
alsco77 Avatar asked Jun 30 '18 11:06

alsco77


People also ask

How do I run ionic on my Android phone?

To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.


Video Answer


3 Answers

Or you could just try something like this :

cd platforms/ios/cordova
npm install ios-sim@latest
like image 56
lokoko Avatar answered Sep 29 '22 03:09

lokoko


If this problem again persist after updating to Mojave then remove and add platform will not going to work.

Instead you can try invoking simulator directly using following command

ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-12-2"

Also, if you are using older build system, you can add additional flag like below

ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-12-2" --buildFlag="-UseModernBuildSystem=0"
like image 29
Anuj Panwar Avatar answered Sep 29 '22 03:09

Anuj Panwar


As of Ionic v5.4.1 and ios-sim@latest (8.0.2), none of the other answers worked for me. What ended up working was running the list command to find the device's UUID then specifying it as the target:

ionic cordova emulate --list
ionic cordova emulate ios -l -c --target="<UUID>"
like image 38
Desmond Avatar answered Sep 29 '22 04:09

Desmond