UICKeyChainStore
2012-10-31 15:28 -king 阅读(2526) 评论(0) 收藏 举报在使用UICKeyChainStore类库的时候 要添加Security.framework
默认的UICKeyChainStore is not ARC compatible,so i do some change by myself.
一种错误是 Implicit conversion of C pointer type 'CFTypeRef' (aka 'const void *') to Objective-C pointer type 'id' requires a bridged cast
这个可以通过默认的解决方法---添加__bridge 来解决
另一个错误是 Error: Cast of an indirect pointer to an Objective-C pointer to 'CFTypeRef ' (aka 'const void *') is disallowed with ARC
在UICKeyChainStore.m中有两处有这个错误 一个是80几行处 一个是280几行处 在网上找到了解决方法 连接如下
http://stackoverflow.com/questions/7822892/pointer-casting-with-arc
80行处修改后为
CFDataRef resultRef;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query,
(CFTypeRef *)&resultRef);
NSData* data = (__bridge_transfer NSData*)resultRef;
280行处修改后为
NSMutableDictionary *result = nil;
CFDataRef resultRef;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, (CFTypeRef *)&resultRef);
got it
now we can use UICKeyChainStore when Objective-C Automatic Reference Counting is yes.
浙公网安备 33010602011771号