I am probably missing something as usual. But I am still not sure why it would crash with unrecognized method crash. I have the following snippet:
NSObject *obj = [NSObject new];
if (@available(iOS 17.0, *)) {
if (obj.isAccessibilityElementBlock != nil) {
BOOL flag = obj.isAccessibilityElementBlock();
}
} else {
NSLog(@"Not ios 17 ");
}
The crash happens on that line: if (obj.isAccessibilityElementBlock != nil)
[NSObject isAccessibilityElementBlock]: unrecognized selector sent to instance
the property is defined and exists at least in public header (and in dynamic method list):
@property (nullable, nonatomic, copy) AXBoolReturnBlock isAccessibilityElementBlock
trying to do similar in swift:
let obj: NSObject = NSObject()
let fun = obj.isAccessibilityElementBlock()
I get a compile error:
Static member 'isAccessibilityElementBlock' cannot be used on instance of type 'NSObject'
BUT its not static, (a little bit strange error)
So my question is appropriate behaviour? and what will be the correct way to use those api?