XCode 中的钥匙串警告
这是我的代码:
//Set
KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"Animex" accessGroup:nil];
[keychain setObject:username forKey:kSecValueData];
[keychain setObject:password forKey:kSecAttrAccount];
[keychain release];
它工作完美,但我收到警告:
"passing argument 2 of 'set object:forkey' discards qualifiers from pointer target type.
这是什么意思? 怎么解决?
here is my code:
//Set
KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"Animex" accessGroup:nil];
[keychain setObject:username forKey:kSecValueData];
[keychain setObject:password forKey:kSecAttrAccount];
[keychain release];
It works perfectly, but I get a warning:
"passing argument 2 of 'set object:forkey' discards qualifiers from pointer target type.
What does it mean?
How to solve?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将参数转换为 id。
kSecValueData 和 kSecAttrAccount 是 CFTypeRef 和 setObject:forKey: 需要一个 id。
CFTypeRef 定义为:
事实上,它是一个 const,因此会向您发出此警告。
Cast the parameter to id.
kSecValueData and kSecAttrAccount are CFTypeRef and setObject:forKey: expects an id.
CFTypeRef is defined as:
It's the fact that it's a const that's giving you this warning.