swift - unicode转义后大括号中的预期十六进制代码

标签 swift xcode6

这在 Swift 的第一个测试版中有效。

var degree = "\u00B0" // degree symbol

现在我遇到了这个错误,我不明白我需要做什么才能在 Xcode 6 Beta 5 中更正它。

Expected hexadecimal code in braces after unicode escape

最佳答案

正确的代码是:

var degree = "\u{00B0}" // degree symbol

来自 Xcode 6 beta 4 发行说明:

The \x, \u and \U escape sequences in string literals have been consolidated into a single and less error prone \u{123456} syntax. (17279286)

关于swift - unicode转义后大括号中的预期十六进制代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25225074/

相关文章:

ios - 触摸并按住 SpriteKit SKSpriteNode 速度

iOS swift单例清除数据

swift - 如何在 Swift 代码中将元组附加到数组对象?

objective-c - 创建桥接头

ios - 在 Swift 中创建 GCD 队列?

ios - `addingPercentEncoding` 在 Xcode 9 中损坏了吗?

swift - 如何使用 Xcode 6 内联代码文档 Swift 源代码

ios - 添加自定义手势识别器以在 Xcode Interface Builder 中查看?

swift - 应用程序崩溃 - dyld : Symbol not found: _OBJC_CLASS_$_UITraitCollection

ios - 动画期间的触觉反馈——模仿 UIPickerView