Ionic iOS 10问题:无法加载错误的网页:找不到具有指定主机名的服务器

问题描述 投票:1回答:1

I have this issue with ionic when I run on a device with 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

Any solutions as to why this is happening?

ios cordova ionic-framework ios10
1个回答
2
投票

我有同样的问题。原来我的系统在/ etc / hosts文件中缺少localhost的条目。添加修复它。

这是一个问题的原因是因为Cordova不使用iOS上的file:// URL来加载带有应用程序的Web视图 - 它使用通过http://localhost:8080访问的内置Web服务器。

© www.soinside.com 2019 - 2024. All rights reserved.