我尝试从 KeyChainItem 中检索一个字符串,该字符串存储如下:
@property (nonatomic, strong) KeychainItemWrapper *account;
if (account == nil) {
account = [[KeychainItemWrapper alloc] initWithIdentifier:@"test" accessGroup:nil]
}
[account setObject:self.username forKey:(__bridge id)(kSecAttrAccount)];
[account setObject:@"c6a07d48aabf35b26e1623fb" forKey:(__bridge id)(kSecValueData)];
当我如下检索它时:
KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"test" accessGroup:nil];
self.account = wrapper;
}
NSString *prevUsername = [account objectForKey:(__bridge id)(kSecAttrAccount)];
NSString *token = [account objectForKey:(__bridge id)(kSecValueData)];
我收到了 NSLog(@"%@",token); 的以下值
<63346264 32636462 64653234 34313862 38633537 31326235 66653464 63303731>
如何检索我保存的字符串?我在这里做错什么了吗?