如何让钥匙串在带有 ARC 的 iOS 5 中工作?
这是此处找到的另一个问题的扩展: iPhone 从钥匙串获取数据字典
正如你所看到的,有一个解决方案:
/*1*/ CFDictionaryRef cfquery = (__bridge_retained CFDictionaryRef)genericPasswordQuery;
/*2*/ CFDictionaryRef cfresult = NULL;
/*3*/ OSStatus status = SecItemCopyMatching(cfquery, (CFTypeRef *)&cfresult);
/*4*/ CFRelease(cfquery);
/*5*/ NSDictionary *result = (__bridge_transfer NSDictionary *)cfresult;
我对 iOS 开发还很陌生,我不太清楚这些代码行应该放在哪里?任何帮助将不胜感激。
谢谢,
杰克
This is an extension of another question found here: iPhone fetch data dictionary from keychain
As you can see there is a solution:
/*1*/ CFDictionaryRef cfquery = (__bridge_retained CFDictionaryRef)genericPasswordQuery;
/*2*/ CFDictionaryRef cfresult = NULL;
/*3*/ OSStatus status = SecItemCopyMatching(cfquery, (CFTypeRef *)&cfresult);
/*4*/ CFRelease(cfquery);
/*5*/ NSDictionary *result = (__bridge_transfer NSDictionary *)cfresult;
I'm quite new to iOS development and I can't quite work out where these lines of codes are supposed to go? Any help would be greatly appreciated.
Thanks,
Jack
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在我的项目中编译了这个版本的 KeychainItemWrapper:
https://gist.github.com/1170641
记得将 Security.framework 添加到您的项目中!
如果仍然出现错误,请检查“构建阶段”下的“编译源”列表。如果 KeychainItemWrapper.m 未列出,请添加它。
I got this version of the KeychainItemWrapper to compile in my project:
https://gist.github.com/1170641
Remember to add Security.framework to your project!
If you still get errors, check the Compile Sources list under Build Phases. If KeychainItemWrapper.m is not listed, add it.