First: I am aware that there are other questions regarding the KeychainItemWrapper already posted. I read them all, but I did not succeed with what should be a really simple task: storing a value in the Keychain (on the device, not simulator). I always get an assertion failure, "Couldn't add the Keychain Item".
Here is my code, I want to get an uuid, and, if not existing, create and store one:
+ (NSString *)getDeviceID{
KeychainItemWrapper * keychain = [[[KeychainItemWrapper alloc]initWithIdentifier:KEYCHAIN_ID accessGroup:nil]autorelease];
NSString * uuid = [keychain objectForKey:KEYCHAIN_ID];
if ( uuid == nil ){
uuid = [self createDeviceID];
[keychain setObject:uuid forKey:@"UUID"];
}
return uuid;
}
I just can't figure it out.