Uncaught (in promise): cordova_not_available in Ionic 2

前端 未结 8 1487
情书的邮戳
情书的邮戳 2020-12-13 12:33

When I\'m running my Ionic app with ionic serve -l command, get following error message:

Runtime Error

Unca

8条回答
  •  无人及你
    2020-12-13 13:10

    this error is generated when you trying to access mobile functionalities on a non mobile device for example if you want access to mobile GPS you need cordova it's the link chain between javascript code and the targeted platform

    the best thing to do is to test the environment you running on if its cordova so you don't fall in the cordova not fund error

        if (this.platform.is('cordova')) {
        // You're on a mobile device "IOS ANDROID WINDOWS" 
        // now you can call your native plugins
      } else {
        // You're testing in a browser so you may want to use another method or run your code on a emulator
      }
    

提交回复
热议问题