我无法让 KeychainItemWrapper(Apple 示例)工作。我已将 KeychainItemWrapper 文件添加到我的项目中,当在手机上运行它时,SecItemAdd 抛出异常,说一个或多个参数无效(结果代码 -50)。触发 SecItemAdd 的代码如下:
KeychainItemWrapper* wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"something" accessGroup:nil];
[wrapper setObject:@"this is my password" forKey:@"password"];
NSLog(@"Password: %@", [wrapper objectForKey:@"password"]);
怎么了?
代码可以在http://developer.apple.com/iphone/library/samplecode/GenericKeychain/index.html找到