cpc
cpc

Reputation: 638

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.

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

Upvotes: 7

Views: 5015

Answers (6)

user2787710
user2787710

Reputation: 11

you need to build it with Xcode and then try running ionic cli again For some reason that fixes it for me

Upvotes: 0

jbgt
jbgt

Reputation: 1636

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

Upvotes: 14

Alexandre Cognard
Alexandre Cognard

Reputation: 21

So native-run seems buggy.

But in fact in ionic-cli, you can pass a param to use cordova instead of native-run and it's work :

ionic cordova run ios --no-native-run

My personal command :

ionic cordova run ios --livereload --consolelogs --buildFlag='-UseModernBuildSystem=0'  --external --no-native-run

Upvotes: 2

Chris
Chris

Reputation: 71

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

Upvotes: 2

Ion Bogatu
Ion Bogatu

Reputation: 19

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

Upvotes: 1

DanConstantin
DanConstantin

Reputation: 35

I am having the same problem. According to this post https://github.com/ios-control/ios-deploy/issues/469 an update to ios-deploy 1.11.2 should solve the problem. I've tried it, multiple times + reinstalling Xcode and other options but nothing works. I am curious if an update to ios-deploy will work for you, so let me know please!

Upvotes: 0

Related Questions