首页 > 解决方案 > 无法加载网页并出现错误:操作无法完成。NSURLErrorDomain 错误 -999 将 Ionic 应用程序部署到 iOS 设备

问题描述

我创建了一个成功部署到 Android 的 Ionic 4 应用程序。它以前在部署到 iOS 时出现问题,现在开始工作它不会在 xcode 中再次部署到 iOS 并显示以下错误:

2019-09-09 20:28:09.836175-0400 [962:15259] Apache Cordova native platform version 5.0.1 is starting.
2019-09-09 20:28:09.836825-0400 [962:15259] Multi-tasking -> Device: YES, App: YES
2019-09-09 20:28:10.091156-0400 [962:15259] Using UIWebView
2019-09-09 20:28:10.094863-0400 [962:15259] [CDVTimer][console] 0.081062ms
2019-09-09 20:28:10.095080-0400 [962:15259] [CDVTimer][handleopenurl] 0.074029ms
2019-09-09 20:28:10.096599-0400 [962:15259] [CDVTimer][intentandnavigationfilter] 1.417994ms
2019-09-09 20:28:10.096769-0400 [962:15259] [CDVTimer][gesturehandler] 0.059962ms
2019-09-09 20:28:10.118206-0400 [962:15259] [CDVTimer][file] 21.324039ms
2019-09-09 20:28:10.118475-0400 [962:15259] GooglePlus pluginInitizalize
2019-09-09 20:28:10.118554-0400 [962:15259] [CDVTimer][googleplus] 0.204921ms
2019-09-09 20:28:10.118677-0400 [962:15259] [CDVTimer][TotalPluginStartup] 24.170041ms
2019-09-09 20:28:10.611689-0400 [962:15259] Resetting plugins due to page load.
2019-09-09 20:28:10.629519-0400 [962:15259] Failed to load webpage with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)
2019-09-09 20:28:10.632449-0400 [962:15259] Resetting plugins due to page load.
2019-09-09 20:28:11.564572-0400 [962:15511] NSURLConnection finished with error - code -1100
2019-09-09 20:28:11.565311-0400 [962:15515] NSURLConnection finished with error - code -1100
2019-09-09 20:28:11.565912-0400 [962:15511] NSURLConnection finished with error - code -1100
2019-09-09 20:28:11.566641-0400 [962:15511] NSURLConnection finished with error - code -1100
2019-09-09 20:28:11.567391-0400 [962:15515] NSURLConnection finished with error - code -1100
2019-09-09 20:28:11.567960-0400 [962:15511] NSURLConnection finished with error - code -1100
2019-09-09 20:28:11.816757-0400 [962:15259] Finished load of: file:///Users/anonymous/Library/Developer/CoreSimulator/Devices/9BB0D1E9-67AE-4A6A-94D0-1174FE78BA52/data/Containers/Bundle/Application/CADC7702-17A6-4138-A01C-5B7A3710A283/AppName.app/www/index.html

我在 StackOverflow 上浏览过类似的错误消息,但它们并没有真正为这个问题提供任何解决方案。

我无法部署到模拟器或设备。

我的 appComponent 很简单:

  initializeApp() {
    firebase.initializeApp(firebaseConfig);

    this.platform.ready().then(() => {
        const unsubscribe = firebase.auth().onAuthStateChanged( user => {
          if (!user) {
            this.router.navigateByUrl('login');
            unsubscribe();
          } else {
            this.router.navigateByUrl('tabs');
            unsubscribe();
          }
        });
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
  }

标签: iosangularxcodefirebaseionic4

解决方案


我通过cordova plugin add cordova-plugin-ionic-webview@latest解决了这个问题


推荐阅读