当我ionic serve
时,我的主页面控制台会向我显示此错误:
ng-cordova-beacon.js:53 Uncaught ReferenceError: cordova is not defined
at Object.requestWhenInUseAuthorization (ng-cordova-beacon.js:53)
at app.js?ionicCachebuster=10643:25
at Array.<anonymous> (ionic.bundle.js?ionicCachebuster=10643:56238)
at onPlatformReady (ionic.bundle.js?ionicCachebuster=10643:2496)
at onWindowLoad (ionic.bundle.js?ionicCachebuster=10643:2477)
但是在html的页面中有:
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js?ionicCachebuster=10643"></script>
<!-- cordova script (this will be a 404 during development) -->
**<script src="cordova.js"></script>**
<script src="js/ng-cordova-beacon.js"></script>
任何人都可以帮助我吗? ;)
答案 0 :(得分:2)
Cordova在浏览器上不可用(正如你在html文件中看到的那样,cordova在开发期间将是404)。如果您使用任何cordova插件或离子本机插件,则必须在真实设备中测试该应用程序。
<强>机器人:强>
ionic platform add android
ionic build android
ionic run android
<强> IOS:强>
ionic platform add ios
ionic build ios
ionic run ios