Livereload can not detect iOS device

Error I’m getting: capacitor run ios --no-sync --target ? exited with exit code 1.

Note: Issue happens for iOS only.
Android works without any issues.

Environment:

  • macOS 12.6
  • xcode 14.1 (14B47b)
  • @ionic/core”: “^6.2.5”,
  • @capacitor/cli”: “^4.0.0”,

Steps to reproduce:

  • Connect iPhone device to mac, make sure it’s “Connect via network” is checked. [screenshot]
  • Disconnect iPhone device from mac
  • Run ionic cap run ios -l --external [here screenshot of what I get]
  • Here is the logs when I tried to run app on my iPhone
ionic cap run ios -l --external
? Which device would you like to target? sultanmyrza’s iPhone 6s (?)
> capacitor sync ios
[capacitor] ✔ Copying web assets from www to ios/App/App/public in 578.89ms
[capacitor] ✔ Creating capacitor.config.json in ios/App/App in 838.83μs
[capacitor] [info] Found 1 Cordova plugin for ios:
[capacitor]        cordova-plugin-purchase@11.0.0
[capacitor] ✔ copy ios in 663.23ms
[capacitor] ✔ Updating iOS plugins in 8.31ms
[capacitor] [info] Found 21 Capacitor plugins for ios:
[capacitor]        @capacitor-community/advertising-id@1.0.0
[capacitor]        @capacitor-community/bluetooth-le@1.7.0
... some logs are removed for simplicity ...
[capacitor]        @capacitor/app@4.1.1
[capacitor]        capacitor-blob-writer@1.0.4
[capacitor] [info] Found 1 Cordova plugin for ios:
[capacitor]        cordova-plugin-purchase@11.0.0
[capacitor] ✔ Updating iOS native dependencies with pod install in 3.54s
[capacitor] ✔ update ios in 3.59s
[capacitor] [info] Sync finished in 4.259s
> ng run app:serve --host=0.0.0.0 --port=8100
[ng] Warning: This is a simple server for use in testing or debugging Angular applications
[ng] locally. It hasn't been reviewed for security issues.
[ng] 
[ng] Binding this server to an open connection can result in compromising your application or
[ng] computer. Using a different host than the one passed to the "--host" flag might result in
[ng] websocket connection issues. You might need to use "--disable-host-check" if that's the
[ng] case.
[ng] - Generating browser application bundles (phase: setup)...
[ng] ✔ Browser application bundle generation complete.
[ng] Initial Chunk Files                                                                                     | Names                                                            |  Raw Size
[ng] vendor.js                                                                                               | vendor                                                           |  11.27 
[ng] Build at: 2022-12-24T07:04:39.192Z - Hash: 9e3725fece7863ad - Time: 12515ms
[ng] ✔ Compiled successfully.

[INFO] Development server running!
       
       Local: http://localhost:8100
       External: http://192.168.100.4:8100
       
       Use Ctrl+C to quit this process

> capacitor run ios --no-sync --target ?
[capacitor] [error] Invalid target ID: ?.
[capacitor]         Valid targets are: , FF96F930-F349-4C2C-B56A-1D8625AF7ECF, 08AE08A5-5F18-4033-981A-52B2616BCD07, 879A722C-B748-4B32-B0CC-F890F0D1AEA2, 443EA531-26E4-481F-AF5A-442D248B32A1, 06389C2E-9D2C-46B3-B8B2-7AF767989973, 76717DC7-5EA0-497F-8FDC-0F0C64F1CBF0, 5327899E-C960-414A-881C-F2905B19C15D, 51597911-25FA-40BF-84F7-ECA912C683A9, A6106108-D023-42A8-9776-29348C1E3F0F, 6185AB2B-A8A9-463C-B168-E107E05A527B, FE3768E4-CFD4-4010-9F36-8119D877487B, E1C71269-C276-4AB2-A1C0-E3A6B4779C29, 5B3CA9A0-4845-4C01-BE6B-D364311CB0A5, 350E34F1-6DEA-4F73-ACE8-2D0EA20921EA, 313FD6DC-7693-4BCB-97C2-02E53194A807, 0247C977-97FE-4C41-A90E-2431C10D94EE, D97BAFAF-EA5B-43AD-9011-30DD7584E2CE, 315ECB96-8518-4395-ABBE-517764007FAF, FCA63029-493B-4FA4-80BD-9637D48F4B41, D4919A4C-5F82-4A7C-A3AD-E2F7C495CD2B, C61C892A-A17A-42B9-9BA3-433C0ED915A4, ABAD7048-0D33-4DF4-A5BA-A59AD7BF8915, 85304D7B-FCF1-4BDB-8E03-5F71B96C7F73, BE7438C3-9F8B-4067-8B34-D511E4ABD225, 28AB875D-19FA-4509-A5C0-D9D77178132A, E94954D4-A317-4F34-9577-85E4D4007A58, 95420FEA-E4C3-4E08-A673-92B417EEBDFE, 300B2E80-61F4-44BE-9565-C538DD49D5C9, CC94F7FE-A9B9-4279-874D-F8D14D774DD4, D332FF61-511A-4285-9B32-8D536BFF0C7E, 0FF7DB6F-BDA4-4316-A3BF-BE571364B4EA, E5AF0D01-C869-4E65-A817-9F08FB3816E8
[ERROR] An error occurred while running subprocess capacitor.
        
        capacitor run ios --no-sync --target ? exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.
1 Like

For me the solution was to actually choose the correct device. My device was listed twice, once with normal name & once with normal name + some weird characters at the end, which might be the targetId?

With the latter one the error did not appear anymore, but a different error appeared (I think later in the run process) which I am still investigating.