Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic serve on iOS 14 device. Error "Invalid Service"

After upgrading an iPhone6s to iOS 14 and Xcode to the latest version, I am unable to serve the app.

The error stack is as following

Error: InvalidService
    at LockdownProtocolReader.parseBody (/usr/local/lib/node_modules/native-run/node_modules/node-ioslib/dist/protocol/lockdown.js:35:19)
    at LockdownProtocolReader.onData (/usr/local/lib/node_modules/native-run/node_modules/node-ioslib/dist/protocol/protocol.js:52:40)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)

running with --verbose shows the origin of the error

client:lockdownd startService: com.apple.debugserver +898ms
  protocol:lockdown socket write: {"Request":"StartService","Service":"com.apple.debugserver"} +206ms
  protocol:lockdown Response: {"Error":"InvalidService","Request":"StartService","Service":"com.apple.debugserver"} +6ms
  native-run Caught fatal error: Error: InvalidService

my serve script is

ionic cordova run iOS --l --debug --device --address=0.0.0.0 --sourceMap=true

Ionic info:

Ionic:

   Ionic CLI                     : 6.11.8 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.2.2
   @angular-devkit/build-angular : 0.900.7
   @angular-devkit/schematics    : 9.1.4
   @angular/cli                  : 9.1.4
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 20 other plugins)

Utility:

   cordova-res                          : not installed
   native-run (update available: 1.1.0) : 1.0.0

System:

   ios-deploy : 1.10.0
   ios-sim    : 8.0.2
   NodeJS     : v12.18.0 (/usr/local/bin/node)
   npm        : 6.14.5
   OS         : macOS Catalina
   Xcode      : Xcode 12.0 Build version 12A7209

what I have tried so far.

  • reboot Mac
  • reboot iPhone
  • make sure latest iOS/Mac/Xcode version is installed
  • clean build

running on emulator is working fine btw. I can also perform ionic build and run via Xcode on the device.

like image 934
cpc Avatar asked Sep 18 '20 12:09

cpc


3 Answers

I solved it by updating native-run to 1.2.1 (see https://github.com/ionic-team/native-run/issues/60, support for iOS 14 has been added in 1.2.0 on 2020-09-28):

npm i -g native-run@latest
like image 188
jbgt Avatar answered Nov 18 '22 07:11

jbgt


Try commenting

     if (isLockdownErrorResponse(resp)) {
         throw new Error(resp.Error);
     }

inside the file

/usr/local/lib/node_modules/native-run/node_modules/node-ioslib/dist/lockdown.js

It worked for me

like image 2
Ion Bogatu Avatar answered Nov 18 '22 06:11

Ion Bogatu


Got the same error while i was using native-run.

So i tried to run it without native-run and used cordova instead with the flag --no-native-run. The command that worked for me:

ionic cordova run ios -l --address=0.0.0.0 --no-native-run
like image 2
Chris Avatar answered Nov 18 '22 08:11

Chris