【问题标题】:Xcode 10.2 support with the latest NativeScript?Xcode 10.2 是否支持最新的 NativeScript?
【发布时间】:2019-08-20 20:26:45
【问题描述】:

使用默认的 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 设置在没有任何进一步配置的情况下工作?

【问题讨论】:

  • 当然 {N} 支持 Xcode 10.2 但上面的问题在于插件。我认为将SWIFT_VERSION 设置为 4 可能会解决您的问题。
  • 我在哪里以及如何做到这一点?
  • 当你说这可能会解决我的问题时 - 它是否需要使用其他 stackoverflow 文章中提到的旧 cocoapods?还是应该在一个全新的默认 nativescript 项目中工作?
  • 是的,我的意思是从 Podfile 修改 Swift 版本。
  • 我不是ios开发者。你有更多关于如何做到这一点的信息吗?

标签: ios swift xcode nativescript nativescript-vue


【解决方案1】:

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

解决方案 1:降级到 Xcode 10.1。

解决方案 2:更新使用 Swift 3 pod 的 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

【讨论】:

  • 解决方案 #2 有效 - 谢谢!我觉得文档需要更新以反映这些事情,不是吗?
  • 我很高兴它成功了。我认为不需要更新文档,因为在发现此问题后不久,nativescript-vue-devtoolsvue-cli-template 已修复。新用户现在会遇到这个问题。老用户,嗯,应该可以在这里或在 Slack 中找到这个答案
  • @TiagoA。只是为了清楚起见——新用户不应该遇到这个问题,对吧?希望这只是上面的一个错字!
  • 是的! :) 新用户不会遇到这个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-03
  • 1970-01-01
  • 1970-01-01
  • 2019-08-17
  • 1970-01-01
相关资源
最近更新 更多