KeyChainStore returns 34018 error

444 Views Asked by At

I am trying to implement KeyChain sharing in my iOS app to share passwords between different iOS applications.

I am using the library UICKeyChainStore for this purpose.

AppDelegate.m (this works)

self.keychainStore = [UICKeyChainStore keyChainStoreWithService:@"PasswordService" accessGroup:@"group_name"];
self.keychainStore[@"password"] = @"abcd1234";
NSLog(@"%@", self.keychainStore[@"password"]);

Inside my ViewController's ViewDidLoad method, the same code simply prints (null) in the console.

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.keychainStore[@"p2"] = @"1234";
NSLog(@"%@", appDelegate.keychainStore[@"p2"]);

When I dug deeper into the library, the error message getting thrown is:

Error Domain=com.kishikawakatsumi.uickeychainstore Code=-34018 "Security error has occurred." UserInfo=0x174e76540 {NSLocalizedDescription=Security error has occurred.}

0

There are 0 best solutions below