0

I am using Keychainwrapper class downloaded from Apple documentation for storing login information like password. In my apps when user click on sign in button, I am storing in key chain like below...

KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] 
                                     initWithIdentifier : @"vmo_login" accessGroup:nil];

[keychainItem setObject:email_id.text forKey:(__bridge NSString*)kSecAttrAccount];
[keychainItem setObject:password.text forKey:(__bridge NSString*)kSecValueData];

And if user click on sign out I am exiting application with exit(1). Once application is launched again, I am reading from keychain like below..

NSString *loc_email1 = [keychainItem objectForKey:(__bridge NSString*)kSecAttrAccount];
NSString *loc_pwd1 = [keychainItem objectForKey:(__bridge NSString*)kSecValueData];

I have not got what I have stored below, it returns NULL. Any Idea?.

thanks.

4

1 回答 1

0

我发现了问题。。

KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] 
                                     initWithIdentifier : @"<need to give same as when we write>" accessGroup:nil];

现在工作正常。

于 2012-08-30T11:41:31.940 回答