I’m trying to test if a specific enum is available in the version of iOS running on a device. I am using a specific enum that is not available in previous versions of the OS. I already know how to test for method availability by using respondsToSelector like this:
if ([self respondsToSelector:@selector(method:)]) {
}
Is there a similar test for enums? If not, how can I test for it?
I don’t think that you can directly check for an enum availability, but you don’t actually need it.
Simply check for one selector availability that you know is available on the same iOS version that you know has got the enum you need. In other words, check for some selector that was added to iOS at the same time as the enum.
It is not actually the same, but I think it does reasonably what you need. If the selector you check for does use that enum, you are pretty close to the perfect solution.