Xcode 10.2 支持最新的 NativeScript?

Xcode 10.2 support with the latest NativeScript?

在使用默认 NativeScript Advanced Mac OS 指令后构建 iOS 项目不起作用。

我有一台全新的 macbook,OSX Mojave 10.14.4,最新可用 Xcode 版本 10.2 (10E125)。

我严格按照 NativeScript 的说明操作: https://docs.nativescript.org/start/ns-setup-os-x

经过几次小插曲后,我可以 Android 工作,但不能 iOS。

我首先从这里找到的问题和解决方案着手:Swift Version NativeScript

但是,在按照步骤将 cocoapods 从 1.6.0 降级到 1.5.3 后,我收到关于 Swift 3.0 / 3.1 不受支持的错误,并且构建失败。

使用文档设置 NativeScript 后,您会看到此错误:

[!] Unable to determine Swift version for the following pods (for each pod):

- `Socket.IO-Client-Swift` does not specify a Swift version and none of the targets (`<my-project>`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

降级 cocoapods 后,您会看到此错误(对于每个 pod):

error: SWIFT_VERSION '3.1' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'Socket.IO-Client-Swift')

我也试过在 Xcode 中打开项目。您会立即从命令行看到相同的错误。

有没有什么方法可以让最新的 Xcode 和默认的 NativeScript 设置无需任何进一步的配置就可以工作?

问题是 Xcode 10.2 带来了 Swift 5 并弃用了 Swift 3。使用过时的 Swift 代码的插件将无法工作。

解决方案 1:降级到 Xcode10.1.

解决方案 2:更新使用 Swift 3 pods.

的 nativescript 插件
  1. 更新到最新nativescript-vue-devtools
npm uninstall nativescript-vue-devtools
npm install --save nativescript-vue-devtools
  1. 将包 nativescript-socket.io 替换为 nativescript-socketio:
npm uninstall nativescript-socket.io
npm install --save nativescript-socketio
  1. 将包 nativescript-toast 替换为 nativescript-toasty:
npm uninstall nativescript-toast
npm install --save nativescript-toasty