如何让钥匙串在带有 ARC 的 iOS 5 中工作?

发布于 2024-12-28 19:24:52 字数 575 浏览 4 评论 0原文

这是此处找到的另一个问题的扩展: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┊风居住的梦幻卍 2025-01-04 19:24:52

我在我的项目中编译了这个版本的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文