我有一个Ionic应用程序,它是用Ionic 3创建的,最近更新为Ionic 5(Angular 8(
该应用程序在Chrome浏览器(带有ionic serve
(中运行时没有任何问题,并且一切正常。
近两周来,我一直在尝试制作一个运行iOS的版本
我安装了最新的XCode 12,并尝试使用ionic cordova build ios --prod
创建构建。构建完成后,我在xCode中打开项目文件,并尝试在iPhone上进行测试
此时会显示登录屏幕,用户可以通过单击登录按钮进行身份验证。这将打开一个InAppBrowser
,用户可以在其中进行身份验证。在成功认证之后,InAppBrowser
关闭并且登录的flag
被设置为true
。
通常,这应该允许在主屏幕中显示一些平铺内容。由于某些原因,页面不会刷新,也不会显示平铺。第一个Rest-request
似乎运行良好,在调试主页后,我可以看到用户信息已成功接收。在xCode中,我可以看到一些错误消息:
2021-03-11 10:37:06.003856+0100 EPDM[795:40716] WF: _WebFilterIsActive returning: NO
2021-03-11 10:37:06.370470+0100 EPDM[795:40716] [ProcessSwapping] 0x108c981a8 - ProvisionalPageProxy::didFailProvisionalLoadForFrame: pageProxyID=13 webPageID=23, frameID=3, navigationID=3
2021-03-11 10:37:06.370687+0100 EPDM[795:40716] [Process] 0x102079218 - [pageProxyID=13, webPageID=18, PID=804] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -1004
2021-03-11 10:37:06.371059+0100 EPDM[795:40716] webView:didFailProvisionalNavigation - -1004: Could not connect to the server.
2021-03-11 10:37:15.669294+0100 EPDM[795:40716] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
我的问题是,是什么原因导致了这个错误?提前感谢您的回答。
"config": {
"ionic_webpack": "./config/webpack.config.js"
},
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"fix": "tslint --c tslint.json 'src/**/*.ts"
},
"dependencies": {
"@angular/animations": "8.2.14",
"@angular/common": "8.2.14",
"@angular/compiler": "8.2.14",
"@angular/compiler-cli": "8.2.14",
"@angular/core": "8.2.14",
"@angular/flex-layout": "^8.0.0-beta.27",
"@angular/forms": "8.2.14",
"@angular/http": "7.2.16",
"@angular/platform-browser": "8.2.14",
"@angular/platform-browser-dynamic": "8.2.14",
"@angular/router": "8.2.14",
"@ionic-native-mocks/http": "^2.0.12",
"@ionic-native/abbyy-rtr": "^5.31.1",
"@ionic-native/barcode-scanner": "^5.31.1",
"@ionic-native/camera": "^5.31.1",
"@ionic-native/core": "^5.31.1",
"@ionic-native/http": "^5.31.1",
"@ionic-native/in-app-browser": "^5.31.1",
"@ionic-native/ionic-webview": "^5.31.1",
"@ionic-native/splash-screen": "^5.31.1",
"@ionic-native/status-bar": "^5.31.1",
"@ionic/angular": "^5.5.4",
"@ionic/angular-toolkit": "2.3.3",
"@ionic/storage": "2.2.0",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
"cordova-android": "^6.4.0",
"cordova-browser": "^4.1.0",
"cordova-ios": "6.2.0",
"cordova-plugin-3dtouch": "1.3.5",
"cordova-plugin-abbyy-rtr-sdk": "^1.0.4",
"hammerjs": "^2.0.8",
"ionicons": "5.4.0",
"lodash": "^4.17.20",
"ngx-progressbar": "^2.1.1",
"npm": "^6.14.8",
"phonegap-plugin-barcodescanner": "^8.1.0",
"rxjs": "^6.6.3",
"rxjs-compat": "^6.6.3",
"svg-pan-zoom": "^3.6.0",
"sw-toolbox": "3.6.0",
"tslint-fix": "^0.1.3",
"zone.js": "0.11.4"
},
"devDependencies": {
"@ahovakimyan/cordova-plugin-wkwebviewxhrfix": "git+https://github.com/AraHovakimyan/cordova-plugin-wkwebviewxhrfix.git",
"@angular-devkit/build-angular": "0.803.19",
"@angular-devkit/build-webpack": "0.803.19",
"@angular-devkit/core": "8.2.2",
"@angular-devkit/schematics": "8.2.2",
"@angular/cli": "8.3.29",
"@angular/compiler-cli": "8.2.14",
"@babel/compat-data": "7.8.0",
"@babel/preset-env": "7.8.0",
"@types/node": "^8.0.45",
"angular2-template-loader": "^0.6.2",
"babel-loader": "8.1.0",
"cordova-plugin-advanced-http": "^3.1.0",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-cookies": "0.0.2",
"cordova-plugin-deeplinks": "^1.1.1",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-inappbrowser": "^5.0.0",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-keychain-touch-id": "^3.2.1",
"cordova-plugin-splashscreen": "^6.0.0",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-wkwebviewxhrfix": "^0.1.0",
"cordova-sqlite-storage": "^5.1.0",
"html-loader": "^0.5.1",
"ionic-plugin-keyboard": "^2.2.1",
"istanbul-instrumenter-loader": "^3.0.0",
"null-loader": "^0.1.1",
"phonegap-plugin-barcodescanner": "^8.1.0",
"ts-loader": "^3.0.3",
"ts-node": "^3.0.2",
"typescript": "3.5.1",
"ws": "3.3.2"
},
"description": "An EpdmMobileApps project",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-keychain-touch-id": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-deeplinks": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-cookies": {},
"cordova-plugin-advanced-http": {
"OKHTTP_VERSION": "3.10.0"
},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-wkwebviewxhrfix": {}
},
"platforms": [
"ios",
"android"
]
}
}
我确实试图找出导致此问题的代码。我在登录过程中注释了一些可能会导致问题的步骤。
在注释掉InAppBrowser的调用后,我没有看到任何错误。我意识到,我从后端收到的重定向导致了InAppBrowser中的loaderror-事件。这就是为什么"webView:didFailProvisionalNavigation-1004:无法连接到服务器。"错误消息。我的其他代码是从InAppBrowser加载错误事件中调用的,我猜WebView在发生错误后无法处理此问题。