简体   繁体   中英

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 (cordova-lib@9.0.1)
   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.

我通过将native-run更新为 1.2.1 解决了它(请参阅https://github.com/ionic-team/native-run/issues/60 ,2020 年 9 月在 1.2.0 中添加了对 iOS 14 的支持- 28):

npm i -g native-run@latest

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

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

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

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM