KeyChainStore returns error 34018

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

For this purpose I use the UICKeyChainStore library.

AppDelegate.m (this works)

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

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

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

When I delve into the library, I get an error message:

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

+5
source share

All Articles