1

I want my app to support iOS 5.0. But Admob has a prerequisite that the deployment target is at least 6.0.

Is there a way to compile my app so that Admob is used only for devices running iOS >= 6.0 ?

I ask because people have done something similar with apple watch so they can support lower deployment targets: iOS7 and Apple Watch

Community
  • 1
  • 1
Rahul Iyer
  • 19,924
  • 21
  • 96
  • 190

1 Answers1

2
/*
 *  System Versioning Preprocessor Macros
 */ 

#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)

Then use like this

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
    //do admob stuff
}
else {
   //don't do admob stuff
}

Also link optional framework which are not available in ios < 6.0

P.S. The macros is taken from this answer

Community
  • 1
  • 1
Inder Kumar Rathore
  • 39,458
  • 17
  • 135
  • 184