Xcode不允许我编译这段代码:
func getIdentity(keychainArray: NSArray) -> SecIdentity? {
let dict = keychainArray[0] as Dictionary<String,AnyObject>
let key = kSecImportItemIdentity.takeRetainedValue()
return dict[key] as SecIdentity?
}
编译器退出并出现以下错误:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SecIdentity", referenced from:
__TFC9messenger10Connection19streamOpenCompletedfS0_FT_T_ in Connection.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我测试了一些东西,并且看到SecIdentity是一个类型别名。 我发现当我尝试将某些内容转换为类型别名时,编译器总是会生成这些错误消息。如果我将它转换为类(例如NSObject / NSDictionary)它确实有效,但CFDictionary也会导致错误。这有帮助吗?