Xcode 6.3 和 Swift:Unicode 实用程序(例如 UCKeyTranslate)不可用? [英] Xcode 6.3 and Swift: Unicode Utilities (e.g. UCKeyTranslate) are not available?

查看:17
本文介绍了Xcode 6.3 和 Swift:Unicode 实用程序(例如 UCKeyTranslate)不可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下测试代码:

import Cocoa
import Carbon
let x = kUCKeyActionDisplay

在 Xcode 6.2 中没有问题,但在 Xcode 6.3 中此代码会引发错误.

In Xcode 6.2 there is no problem, but in Xcode 6.3 this code throws an error.

错误信息是:Use of unresolved identifier 'kUCKeyActionDisplay'.

为什么我无法访问 UnicodeUtilities 命名空间?

Why can't I access the UnicodeUtilities namespace?

推荐答案

根据 OSX 10.10.3 API 文档.

然而,您仍然可以在 Objective-C 中以相同的方式访问它们(即 @import CoreServices;)

You can however still access them in Objective-C, in the same way (i.e. @import CoreServices;)

我刚刚在 Objective-C 中编写了需要它们的代码 - 你当然可以创建一个包装器.

I've just written the code that needs them in Objective-C - you could of course create a wrapper.

这篇关于Xcode 6.3 和 Swift:Unicode 实用程序(例如 UCKeyTranslate)不可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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