我正在使用从Apple的有用UIElementUtilities应用程序中借用的Core Foundations方法。问题是我希望更新这个借用的方法,以便在Apple的新自动引用计数(ARC)系统下运行。通过在变量之前插入'__bridge'限定符,我已经取得了一些进展,但是使用下面显示的方法,尝试转换为ARC后出现以下错误:“error:Incompatible types cast'NSString __strong *'到'CFTypeRef *'(aka'const void **)用__bridge cast“。我该如何制作一个可接受的指向'actionDescription'缓冲区的指针,以便将其内容重新改写为NSString?ARC不兼容类型铸造
+ (NSString *)descriptionOfAction:(NSString *)actionName ofUIElement:(AXUIElementRef)element {
NSString * actionDescription = nil;
AXUIElementCopyActionDescription(element, (__bridge CFStringRef)actionName, (__bridge CFStringRef *)&actionDescription);
return actionDescription;
//return [actionDescription autorelease];
}
感谢您的解决方案和解释,但很明显,我是在我的头上。 – Antony 2014-12-06 16:04:13