1

当我在模拟器中使用它时它正在工作,但是当我在 iPhone 设备中运行它时它不起作用。

为什么会发生这种情况,如何做到这一点?

- (void) RememberUserAccount:(NSString *) userName password:(NSString *) password {
//NSString *uuid = [[NSUUID UUID] UUIDString];
NSString *identifierForVendor = [[UIDevice currentDevice].identifierForVendor UUIDString];
KeychainItemWrapper *keyWrapper=[[KeychainItemWrapper alloc]initWithIdentifier:identifierForVendor accessGroup:@"hello.lt"];
[keyWrapper setObject:userName forKey:(id)kSecAttrAccount];
[keyWrapper setObject:password forKey:(id)kSecValueData];

}

这是错误:

erminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Couldn't add the Keychain Item.'

感谢!

4

0 回答 0