I would like to have a macro that allows me to check the version or higher than the ios 13. I don't want to use that :
if (@available(iOS 13, *)) {
// iOS 13 (or newer) ObjC code
} else {
// iOS 12 or older code
}
Because the preprocessor will try to compile it and will not be able to do it. What I want is a macro that allows to compile properly without warning or errors message. Something like that:
#ifdef __IPHONE_13_0
But I am not sure that line means 13.0 or higher.
My code in the .h is the following:
#ifdef __AVAILABILITY_INTERNAL__IPHONE_13_0
@property (nonatomic, retain) UIViewController *popoverController;
#else
@property (nonatomic, retain) UIPopoverController *popoverController;
#endif
It doesn't work. How to check in the .h file the version of the ios? I cannot use that as it is in the .h file :
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
if (SYSTEM_VERSION_LESS_THAN(@"5.0")) {
// code here
}
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
// code here
}
What do you think ?
EDIT: How to avoid to get the message for the ipads before a previous version?