问题
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