如何在Objective-C中转换间接指针

时间:2013-07-23 23:48:20

标签: ios objective-c pointers casting

我正在尝试对我的钥匙串做一些工作,并且正在关注本教程here 不幸的是,我在讨论搜索钥匙串时遇到以下错误

Cast of an indirect pointer to an Objective-C pointer to 'CFTypeRef *' (aka 'const void **') is disallowed with ARC

这就是代码的样子

 OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)searchDictionary,(CFTypeRef *)&result);

非常感谢任何提供有关如何投射间接指针的正确代码的帮助。

1 个答案:

答案 0 :(得分:27)

使用void *代替:

 OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)searchDictionary,(void *)&result);