Here's an approach i came up with for checking IOS versions.
#define __PROCESS_INFO ([NSProcessInfo processInfo])
#define CURRENT_IOS ([__PROCESS_INFO operatingSystemVersion])
#define IOS(x) ((NSOperatingSystemVersion){[x integerValue], 0, 0})
#define IOS9 ((NSOperatingSystemVersion){9, 0, 0})
#define IOS10 ((NSOperatingSystemVersion){10, 0, 0})
#define IOS11 ((NSOperatingSystemVersion){11, 0, 0})
#define IS_IOS9 ([__PROCESS_INFO isOperatingSystemAtLeastVersion:IOS9] && \
![__PROCESS_INFO isOperatingSystemAtLeastVersion:IOS10])
#define IS_IOS10 ([__PROCESS_INFO isOperatingSystemAtLeastVersion:IOS10] && \
![__PROCESS_INFO isOperatingSystemAtLeastVersion:IOS11])
that way this type of code is more readable
if (IS_IOS9) {
// [... openURL: ...];
}
else if (IS_IOS10) {
// [... openURL:options:completionHandler: ...];
}
Let me know what you think ...