Undefined symbols for architecture i386: “_OBJC_CLASS_$_SecIdentity”

北慕城南 提交于 2019-12-11 08:38:11

问题


Xcode won't let me compile this code:

func getIdentity(keychainArray: NSArray) -> SecIdentity? {
    let dict = keychainArray[0] as Dictionary<String,AnyObject>
    let key = kSecImportItemIdentity.takeRetainedValue()
    return dict[key] as SecIdentity?
}

The compiler quits with following error:

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)

I tested a few thing and have seen that SecIdentity is a type alias. I found out that the compiler always generates these error messages when i try to cast something to a type alias. If i cast it to a class (eg. NSObject / NSDictionary) it does work, but CFDictionary would also lead to a error. Does that help?


回答1:


SecIdentity and friends are part of the Security Framework, so it sound like you need to link against that.



来源:https://stackoverflow.com/questions/24122645/undefined-symbols-for-architecture-i386-objc-class-secidentity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!