My project is using Automatic Reference Counting, and I’m trying to use the following Accessibility API function:
extern AXError AXUIElementCopyAttributeValue (
AXUIElementRef element,
CFStringRef attribute,
CFTypeRef *value);
To call the function, I’m doing something like this:
NSArray *subElements = nil;
AXUIElementCopyAttributeValue(..., (CFArrayRef *)&subElements);
However, ARC is throwing the following error regarding the last argument:
error: Automatic Reference Counting Issue: Cast of an indirect pointer to an Objective-C pointer to 'CFArrayRef *' (aka 'const struct __CFArray **') is disallowed with ARC
How do I resolve this?
Have you tried using an intermediate CFArrayRef, so that you can still pass a pointer to a ref (ie, a pointer to a pointer) to
AXUIElementCopyAttributeValue, but can then achieve the toll-free bridge with just an ordinary cast? E.g.