我已将 Ionic 3 应用程序移植到 Ionic 4 并更新了很多我的依赖项。我的 Ionic 4 应用程序在浏览器中完美运行。上周,我将我的 Xcode 从 10.1 更新到了 10.2。Xcode 在更新中放弃了对 Swift 3 的支持,并且 ionic cordova 似乎只能在 swift 3 中导出项目。结果,我的应用程序不再在 Xcode 模拟器中运行。
我已经尝试将 Ionic 4 和 Cordova 更新到它们的最新版本,然后将我的代码部署到 IOS 而不是特定于版本。我只运行$ ionic cordova add ios
,它仍然在 Swift 3 中构建项目。在 Hail Mary 尝试尝试解决 Xcode 中的问题时,我通过构建设置手动将项目语言更改为 Swift 4。我遇到了一个致命的已弃用错误,我允许 Xcode 的 FIXME 按钮解决该错误。之后,模拟器能够加载 Ionic 4 应用程序......但我所有基于 API 的请求都不起作用。
离子信息:
Ionic:
ionic (Ionic CLI) : 4.12.0 (/Users/tavosoto/.nvm/versions/node/v11.7.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.2.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.3.0
Cordova:
cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : ios 5.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 15 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/tavosoto/Library/Android/sdk/)
ios-sim : 7.0.0
NodeJS : v11.7.0 (/Users/tavosoto/.nvm/versions/node/v11.7.0/bin/node)
npm : 6.5.0
OS : macOS Mojave
Xcode : Xcode 10.2 Build version 10E125
在模拟器中引发 API 请求错误:
ERROR: {"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":"https://example.com/api/v1/legal","ok":false,"name":"HttpErrorResponse","message":"Http failure response for https://example.com/api/v1/legal: 0 Unknown Error","error":{"isTrusted":true}}
预期结果是 Ionic 4 和 Cordova 可以在 Swift 4 中成功导出 IOS 平台,以支持在 Xcode 10.2 中弃用 Swift 3。