KeychainItemWrapper linking error
Asked Answered
D

1

6

I just tried to use the KeychainItemWrapper provided by Apple, but I'm getting a linking error each time:

Undefined symbols for architecture i386: "_OBJC_CLASS_$_KeychainItemWrapper", referenced from: objc-class-ref in DataModel.o

ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've included the Security framework and checked why Apple included in the Xcode project, but I can't seem to find what else is going wrong.

_keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"com.website.project" accessGroup:nil];
[_keychain setObject:_username forKey:(id)kSecAttrAccount];
[_keychain setObject:_password forKey:(id)kSecValueData];

I also added "com.website.project" to my Keychain Access Groups.

Decemvirate answered 16/5, 2012 at 2:57 Comment(1)
+1 you made me realize I forgot to add security framework ;-)Higbee
B
11

Be sure the KeychainItemWrapper is in the "Compile Sources" list.

Bushy answered 16/5, 2012 at 3:3 Comment(2)
Aha, that works, thanks, shouldn't it be added automaticly when I import it in any class?Decemvirate
You have to tick the check mark next to the name of your target when you import files (I know, annoying).Bushy

© 2022 - 2024 — McMap. All rights reserved.