I'm attempting to use a library which has a iOS5 and iOS4.3 flavours. The problem I'm having is getting the right version included conditionally, i.e:
for iOS5:
#include ios5stuff.h
@implementation
// do stuff
@end
For iOS4
#include ios4stuff.h
@implementation
// do stuff
@end
I can see how to conditionally include stuff within the class's implementation block, but not outside this. Can anyone suggest the best way of doing this?
You should be able to do this (untested):
#import <Availability.h>
#if defined(__IPHONE_5_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0
#import "my_header_for_io5_and_above.h"
#elif defined(__IPHONE_4_3) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_3
#import "my_header_for_ios4.3.h"
#else
#error Your SDK is too old ! Need at least 4.3.
#endif
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