5

Regardless of --target variable, the following commands fail:

ionic cordova run ios --target="iPhone-X"

ionic cordova run ios --target="iPhone 12"

ionic cordova emulate ios --debug --target="iPhone 11" -- --buildFlag="-UseModernBuildSystem=0"

The error is:

[native-run] ERR_DEVICE_LOCKED: Device still locked after 1 minute. Aborting.
[ERROR] An error occurred while running subprocess native-run.

It's happening after I switched to Apple Silicon (M1) MacBook Pro, but I'm not 100% sure. Thanks!

Joesy_Mosk
  • 123
  • 1
  • 9
  • 1) What happens if you simply try `ionic cordova run ios` 2) Are you able to get the emulator to start on its own? –  Jan 18 '21 at 18:45
  • @E.Maggini 1) it starts iPod touch... 2) yes, by default launching Simulator starts iPhone 12 Pro Max – Joesy_Mosk Jan 19 '21 at 17:10

5 Answers5

5

I'd the same issue today and it turns out that it works using the "Target ID" instead of "Target Name".

  1. Check the list of available targets using --list option
ionic cordova run ios --list
  1. Run the same command with TARGET ID.
ionic cordova run ios --target="...TARGET-ID-1A2B3B..."

Just to mention, I'm on INTEL-based MacBook Pro.

s_galstyan
  • 61
  • 4
  • Even though, according to ***cordova-cli*** documentation, the `--target` option expecting the name of a device. https://cordova.apache.org/docs/en/latest/reference/cordova-cli/ – s_galstyan Feb 11 '21 at 10:09
2

This worked for me!

Check the list of available targets using --list option

ionic cordova run ios --list

Run the same run command with TARGET ID.

ionic cordova run ios --target="XXXXXXXXXXXXXXX"
gilzon.me
  • 109
  • 2
  • 6
1

For me this message occured in a different situation. The device has not yet been registered to the Apple account!

So I started it once with XCode, it registered the device automatically (for me) and then it was working.

Volker Andres
  • 849
  • 14
  • 32
0

Here, I executed:

native-run ios --virtual --list

And next,

cordova build ios --debug --emulator && native-run ios --app platforms/ios/build/emulator/MyApp.app --virtual --forward 8100:8100 --target <TARGET ID>

Other alternative:

native-run ios --app platforms/ios/build/emulator/MyApp.app --virtual --forward 8100:8100 --target <TARGET_ID>
0

There are three steps to solve this issue:

Step 1a: Make sure that you have the latest native-run by running

npm install -g native-run

Step 1b: Check the up to date version

native-run --version

Step 2: Make sure that the device is enabled as a development machine simply from your iPad/iPhone go "Privacy & Security" then set "Developer Mode" to "On"

Step 3: Check the list of available targets using --list option

ionic cordova run ios --list

Step 4: Run the same command with TARGET ID.

ionic cordova run ios --target="DEVICE_TARGET_ID_SHOWN_IN_STEP3"

Step 5: If the above did not work, then make sure that you have the device registered to your developer account. Open the project in Xcode, then go to "Signing & Capabilities", then register the device.

Future2020
  • 9,939
  • 1
  • 37
  • 51