Xcode 9 Swift 语言版本 (SWIFT_VERSION) [英] Xcode 9 Swift Language Version (SWIFT_VERSION)

查看:36
本文介绍了Xcode 9 Swift 语言版本 (SWIFT_VERSION)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将 xcode 更新到版本 9.在此之前,在 Xcode 8.x 中每当我使用 pod update 时,它都会向我显示一个更新代码,用于将代码转换为 Swift 3 并执行此操作解决错误.但现在它给了我这个错误:

I've recently updated xcode to version 9. Before that in Xcode 8.x whenever I use to do pod update it shows me an update code to convert the code to Swift 3 and doing that solve the errors. But now it is giving me this error:

必须设置Swift 语言版本"(SWIFT_VERSION) 构建设置到使用 Swift 的目标的支持值.这个设置可以在构建设置编辑器中设置.

The "Swift Language Version" (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

对于这个错误,我尝试了 Build Settings >Swift 语言版本,它是 Swift 3.2但是由于更新调用重新安装了一些像 Alamofire 这样的 pod,它说要安装 Xcode 8.x 以将代码转换为 Swift 3,所以我是否需要使用最新的 Xcode 安装附加版本?如果是,那么如何使用 Xcode 9 安装 Xcode 8?

For this error I've tried Build Settings > Swift Language Version and it was Swift 3.2 But as the update call has re-installed some of the pods like Alamofire and it says to install Xcode 8.x to convert the code to Swift 3 so do I need to install an additional version with the latest Xcode? If yes, then how can I install Xcode 8 with Xcode 9?

推荐答案

回答你的问题:
您可以从 Apple 下载门户下载 Xcode 8.3.3(或查看:从哪里下载旧版本的 Xcode),如果您有高级开发者帐户(apple id).您可以安装 &在单个 (mac) 系统中同时使用 Xcode 9 和 Xcode 8.x.(确保您的 Command Line Tools 支持两个版本的 Xcode,以使用终端(请参阅:如何安装'命令行工具'))

Answer to your question:
You can download Xcode 8.x from Apple Download Portal or Download Xcode 8.3.3 (or see: Where to download older version of Xcode), if you've premium developer account (apple id). You can install & work with both Xcode 9 and Xcode 8.x in single (mac) system. (Make sure you've Command Line Tools supporting both version of Xcode, to work with terminal (see: How to install 'Command Line Tool'))

提示:如何迁移与 Xcode 9 兼容的 Swift 版本(Swift 3.2 或 4)
Xcode 9 仅允许从 Swift 3.0 转换/迁移到 Swift 3.2/4.0.因此,如果您项目的当前 Swift 语言版本低于 3.0,那么您必须使用 Xcode 8.x 在 Swift 3 兼容版本中迁移您的代码.

Hint: How to migrate your code Xcode 9 compatible Swift versions (Swift 3.2 or 4)
Xcode 9 allows conversion/migration from Swift 3.0 to Swift 3.2/4.0 only. So if current version of Swift language of your project is below 3.0 then you must migrate your code in Swift 3 compatible version Using Xcode 8.x.

这是 Xcode 9 在迁移过程中识别 Swift 语言低于 3.0 时显示的常见错误消息.

This is common error message that Xcode 9 shows if it identifies Swift language below 3.0, during migration.


Xcode 9 支持 Swift 3.2 &Xcode 8 两者.


Swift 3.2 is supported by Xcode 9 & Xcode 8 both.

项目 ►(选择您的项目目标)► 构建设置 ►(在搜索栏中键入swift")Swift 编译器语言 ► Swift 语言版本 ► 单击语言列表将其打开.

Project ► (Select Your Project Target) ► Build Settings ► (Type 'swift' in Searchbar) Swift Compiler Language ► Swift Language Version ► Click on Language list to open it.



使用 Xcode 8 将源代码从 Swift 2.0 转换为 3.2,然后继续使用 Xcode 9(Swift 3.2 或 4).



Convert your source code from Swift 2.0 to 3.2 using Xcode 8 and then continue with Xcode 9 (Swift 3.2 or 4).

为了更轻松地迁移您的代码,请按照以下步骤操作:(它将帮助您转换为您的 Xcode 工具支持的最新版本的 swift)

For easier migration of your code, follow these steps: (it will help you to convert into latest version of swift supported by your Xcode Tool)

Xcode: Menus: Edit ▶ Covert ▶ To Current Swift Syntax

Xcode: Menus: Edit ▶ Covert ▶ To Current Swift Syntax

这篇关于Xcode 9 Swift 语言版本 (SWIFT_VERSION)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆