ionic
的设备上run
时遇到iOS 10
的问题。当我使用--livereload
在iOS 11
的设备上不会发生此问题
每次我打开应用程序时,都会显示此错误Failed to load webpage with error: A server with the specified hostname could not be found.
xCode
给了我这个错误日志:
2018-07-26 12:47:42.992859 TiTo - Talent in Talent out[25140:1448259] Apache Cordova native platform version 4.5.3 is starting.
2018-07-26 12:47:42.993464 TiTo - Talent in Talent out[25140:1448259] Multi-tasking -> Device: YES, App: YES
2018-07-26 12:47:43.005162 TiTo - Talent in Talent out[25140:1448259] CDVWKWebViewEngine: trying to inject XHR polyfill
2018-07-26 12:47:43.066966 TiTo - Talent in Talent out[25140:1448259] CDVWKWebViewEngine will reload WKWebView if required on resume
2018-07-26 12:47:43.067084 TiTo - Talent in Talent out[25140:1448259] Using Ionic WKWebView
2018-07-26 12:47:43.067705 TiTo - Talent in Talent out[25140:1448259] [CDVTimer][console] 0.093937ms
2018-07-26 12:47:43.067900 TiTo - Talent in Talent out[25140:1448259] [CDVTimer][handleopenurl] 0.102997ms
2018-07-26 12:47:43.070127 TiTo - Talent in Talent out[25140:1448259] Unlimited access to network resources
2018-07-26 12:47:43.070232 TiTo - Talent in Talent out[25140:1448259] [CDVTimer][intentandnavigationfilter] 2.179027ms
2018-07-26 12:47:43.070364 TiTo - Talent in Talent out[25140:1448259] [CDVTimer][gesturehandler] 0.062943ms
2018-07-26 12:47:43.086203 TiTo - Talent in Talent out[25140:1448259] [CDVTimer][splashscreen] 15.730023ms
2018-07-26 12:47:43.086310 TiTo - Talent in Talent out[25140:1448259] CDVIonicKeyboard: resize mode 1
2018-07-26 12:47:43.087343 TiTo - Talent in Talent out[25140:1448259] [CDVTimer][keyboard] 1.037002ms
2018-07-26 12:47:43.087429 TiTo - Talent in Talent out[25140:1448259] [CDVTimer][TotalPluginStartup] 19.853950ms
2018-07-26 12:47:43.601648 TiTo - Talent in Talent out[25140:1448259] Failed to load webpage with error: A server with the specified hostname could not be found.
现在,我尝试删除所有插件,只保留默认ionic start myApp <template_here>
上剩下的内容。它仍然为我提供了iOS 10上的相同问题
这是我的ionic info
输出:
cli软件包:(/ usr / local / lib / node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
全局软件包:
cordova (Cordova CLI) : 8.0.0
本地软件包:
@ionic/app-scripts : 3.1.10
Cordova Platforms : ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
系统:
ios-deploy : 1.9.2
ios-sim : 6.1.2
Node : v8.10.0
npm : 6.1.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
答案 0 :(得分:1)
我有同样的问题。原来,我的系统在/ etc / hosts文件中缺少localhost
的条目。添加修复它。
这是一个问题,原因是Cordova在iOS上不使用file:// URL来加载该应用的网络视图–它使用通过http://localhost:8080访问的内置网络服务器。