我调用它来获取 的属性名称数组AXUIElement element
。
var attrNames: CFArray? = nil;
AXUIElementCopyAttributeNames(element, &attrNames);
我的理解是attrNames
是CFArray
。CFString
然后我打电话:
var foo = CFArrayGetValueAtIndex(attrNames!, idx)
在 Objective-C 中,此相应调用返回一个NSArray*
。CFString*
如何在 Swift 中访问此数组的各个字符串?
我尝试了这个:
let attrName : NSString = (NSString) CFArrayGetValueAtIndex(attrNames!, index);
但它不能编译:
Cannot convert value of type '(NSString).Type' to specified type 'NSString'
我也尝试CFString
过NSString
,但是收到了类似的消息。