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.
There is no method to check for the availability of the enum at the runtime. Best method would be to check for iOS version or check for the feature that you would want to enable or provide depending on the iOS version. If you can tell us the feature, I'm sure someone out here will surely be able to help you out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With