Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic Target Device not found

I have an ionic3 project and I'm trying to run it on iphone plus 8, 12.4 emulator. However when I run:

ionic cordova emulate ios --target="iPhone-8-Plus" --verbose

It gives me an error:

** BUILD SUCCEEDED **

Command finished with error code 0: xcodebuild -workspace,MyApp.xcworkspace,-scheme,MyApp,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone 8 Plus,build,CONFIGURATION_BUILD_DIR=/Users/myuser/MyProjects/mobileapp/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/myuser/MyProjects/mobileapp/platforms/ios/build/sharedpch,-UseModernBuildSystem=0
No scripts found for hook "after_compile".
No scripts found for hook "after_build".
> native-run ios --app "platforms/ios/build/emulator/MyApp.app" --target iPhone-8-Plus --verbose
[native-run] 2019-08-08T10:01:24.916Z client:usbmuxd connectUsbmuxdSocket
[native-run] 2019-08-08T10:01:24.919Z client:usbmuxd getDevices
[native-run] 2019-08-08T10:01:24.920Z protocol:usbmux socket write: {"messageType":"ListDevices"}
[native-run] 2019-08-08T10:01:25.517Z protocol:usbmux Response: {"DeviceList":[]}
[native-run] 2019-08-08T10:01:25.523Z native-run Caught fatal error: { Error: No device or simulator with UDID "iPhone-8-Plus" found
[native-run]     at Object.run (/usr/local/lib/node_modules/native-run/dist/ios/run.js:47:23)
[native-run]     at process._tickCallback (internal/process/next_tick.js:68:7) code: 'ERR_TARGET_NOT_FOUND', exitCode: 1, data: undefined }
[native-run] ERR_TARGET_NOT_FOUND: No device or simulator with UDID "iPhone-8-Plus" found
[ERROR] An error occurred while running subprocess native-run.

        native-run ios --app "platforms/ios/build/emulator/MyApp.... exited with exit code 1.

I run the following to check the devices:

ionic cordova emulate --list
[native-run]   iPad (5th generation) 12.4 80B0D70B-2E2D-4D9C-B098-119AC267E908
[native-run]   iPad (6th generation) 12.4 C9975663-AD93-4582-8521-8DECF6BBE611
[native-run]   iPad Air 12.4 C6235A65-D421-464E-A0CE-A238E851F511
[native-run]   iPad Air (3rd generation) 12.4 672C4237-B6FE-4F30-8BE8-F1D1E6D1A0BA
[native-run]   iPad Air 2 12.4 FB5447BD-E1AE-4434-943F-64C940C467D5
[native-run]   iPad Pro (10.5-inch) 12.4 54C47CD4-4074-4021-A355-57DBE30A6223
[native-run]   iPad Pro (11-inch) 12.4 FCFD179A-C8E1-48AF-94A4-95CFEF37C88C
[native-run]   iPad Pro (12.9-inch) 12.4 76BCB2BD-75E1-473C-B73E-3E7D6EE9B7ED
[native-run]   iPad Pro (12.9-inch) (2nd generation) 12.4 8F73DCAD-9BDB-4009-AB2E-910745F5EEB0
[native-run]   iPad Pro (12.9-inch) (3rd generation) 12.4 ADDC043D-9476-49CF-8FD9-D9F92A0AF4DE
[native-run]   iPad Pro (9.7-inch) 12.4 252EB4D4-17A3-465E-8A26-9F0EA1D28999
[native-run]   iPhone 5s 12.4 4284CF9C-AEBE-4890-83FF-D8C3B0BA47B9
[native-run]   iPhone 6 12.4 A4BF9A50-2FF6-49B0-82B8-F3EDA6DB6E0B
[native-run]   iPhone 6 Plus 12.4 904CE565-198F-49BD-A5A3-DE927B320CD0
[native-run]   iPhone 6s 12.4 3B3225E7-2591-4441-991E-3B1CE494CE90
[native-run]   iPhone 6s Plus 12.4 4A5431F9-B7B5-45F2-A7F9-4CFB633D7BF0
[native-run]   iPhone 7 12.4 7DBEA756-7759-4025-809B-D6704FF23223
[native-run]   iPhone 7 Plus 12.4 1E7DF2AB-E4AE-4834-8BFA-328E8B7DE34E
[native-run]   iPhone 8 12.4 B1BBB831-4C2C-4107-A3B1-F5C3B6699957
[native-run]   iPhone 8 Plus 12.4 DFB1E30F-AEC9-4089-8D16-2AC71FC6B704
[native-run]   iPhone SE 12.4 30AC9EE2-8132-4A61-B7B2-E651A7C7691E
[native-run]   iPhone X 12.4 1C20F1D6-132D-46F1-AE1E-A027984D832A
[native-run]   iPhone Xs 12.4 490D0B7C-5044-4E07-830B-E8FDBC8E8B7C
[native-run]   iPhone Xs Max 12.4 A5CD7626-8954-4CF9-8603-168CA1BCAAFD
[native-run]   iPhone Xʀ 12.4 B776F557-C4BD-49A8-9F81-5F6AD839AD0A

and then:

./myproject/platforms/ios/cordova/lib/list-emulator-images
Apple-Watch-Series-2-38mm, watchOS 5.3
Apple-Watch-Series-2-42mm, watchOS 5.3
Apple-Watch-Series-3-38mm, watchOS 5.3
Apple-Watch-Series-3-42mm, watchOS 5.3
Apple-Watch-Series-4-40mm, watchOS 5.3
Apple-Watch-Series-4-44mm, watchOS 5.3
iPhone-5s, 12.4
iPhone-6, 12.4
iPhone-6-Plus, 12.4
iPhone-6s, 12.4
iPhone-6s-Plus, 12.4
iPhone-7, 12.4
iPhone-7-Plus, 12.4
iPhone-8, 12.4
iPhone-8-Plus, 12.4
iPhone-SE, 12.4
iPhone-X, 12.4
iPhone-XS, 12.4
iPhone-XS-Max, 12.4
iPhone-XR, 12.4
iPad-Air--3rd-generation-, 12.4
iPad-Air, 12.4
iPad-Air-2, 12.4
iPad--5th-generation-, 12.4
iPad-Pro--9-7-inch-, 12.4
iPad-Pro, 12.4
iPad-Pro--12-9-inch---2nd-generation-, 12.4
iPad-Pro--10-5-inch-, 12.4
iPad--6th-generation-, 12.4
iPad-Pro--11-inch-, 12.4
iPad-Pro--12-9-inch---3rd-generation-, 12.4
Apple-TV-1080p, tvOS 12.4
Apple-TV-4K-4K, tvOS 12.4
Apple-TV-4K-1080p, tvOS 12.4

I have tried different target options such as 'iPhone-8-Plus', iPhone 8 Plus, "iPhone-8-Plus, 12.4", "DFB1E30F-AEC9-4089-8D16-2AC71FC6B704" (the id that is beside iphone 8 plus, but without any success.

If I open the project from xcode and run it from there it works properly.

Any ideas? Thanks

like image 356
Symeon Mattes Avatar asked Aug 08 '19 10:08

Symeon Mattes


2 Answers

You have to run the below command :

ionic cordova run ios --livereload --target "BA4986B3-9102-4250-91BF-7DDF7D7BC60D"

where target is the device Id from your list

like image 131
Utsav Gupta Avatar answered Oct 17 '22 10:10

Utsav Gupta


It turns out that the result from $ cordova emulate --list is different from $ native-run --list (you run both commands and you'll see device names are different).

The Ionic CLI uses native-run by default to run the emulator so device names you got with the emulate --list command won't match. You need to run your app using cordova instead of native-run by adding the flag --no-native-run:

$ ionic cordova emulate ios --target="iPhone-8-Plus" --no-native-run

ionic cordova run

This command will first use ionic build to build web assets (or ionic serve with the --livereload option). Then, cordova build is used to compile and prepare your app. Finally, the native-run utility is used to run your app on a device. To use Cordova for this process instead, use the --no-native-run option.

From https://ionicframework.com/docs/cli/commands/cordova-run

like image 32
Raschid JFR Avatar answered Oct 17 '22 10:10

Raschid JFR