【问题标题】:How can I get keychain to work in iOS 5 with ARC?如何让钥匙串在带有 ARC 的 iOS 5 中工作?
【发布时间】:2012-01-24 13:55:04
【问题描述】:

这是此处发现的另一个问题的扩展:iPhone fetch data dictionary from keychain

如您所见,有一个解决方案:

/*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 开发还很陌生,我不太清楚这些代码行应该去哪里?任何帮助将不胜感激。

谢谢,

杰克

【问题讨论】:

    标签: ios ios5 automatic-ref-counting keychain


    【解决方案1】:

    我在我的项目中编译了这个版本的 KeychainItemWrapper: https://gist.github.com/1170641

    记得将 Security.framework 添加到您的项目中!

    如果您仍然遇到错误,请检查 Build Phases 下的 Compile Sources 列表。如果 KeychainItemWrapper.m 没有列出,添加它。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多