Detect if an app is running on iOS beta?

I have apps that support iAd / AdMob in the iOS app store. I notice that every time a beta version of iOS comes out, ad requests fall. I guess this is due to the fact that many people launch a beta version of the OS and almost always get a test iAd ad. Is there a way my code can determine if the application is in a beta version of the OS? That way, I can use AdMob by default to generate revenue.

+4
source share
2 answers

This is not a pretty way to do this, but you can read the device version and compare it with the highest current release version and return to AdMob if the device version is higher.

This will result in the device version as a string:

[[UIDevice currentDevice] systemVersion] 

You can convert this value to a float and compare it with a hard-coded version, but that would mean deploying a new version after the release of the new iOS:

 if ([[[UIDevice currentDevice] systemVersion] floatValue] > 4.3) { // revert to AdMob... } 

As a slightly better solution, you can request the current maximum version of iOS release from the website ... just release the iosversion.txt file on your website with the content “4.3” and use it to control the switch.

Unfortunately, there is no method like [[UIDevice currentDevice] isBeta] .

+7
source

According to rumors, the version of iOS 8 will appear in September.

So you can use:

 NSDate *today = [NSDate date]; NSString *releaseDateString = @"2014-09-15 00:00:00"; NSDateFormatter *dateFormater = [[NSDateFormatter alloc] init]; [dateFormater setDateFormat:@"yyyy-MM-DD HH:mm:ss"]; NSDate *release = [dateFormater dateFromString:releaseDateString ]; NSComparisonResult comp = [today compare:release]; if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 && result == NSOrderedAscending) return @"Beta"; else return @"Release Version"; 

or get the name of the URL: https://www.apple.com/ios/ and check iOS?

 - (void)webViewDidFinishLoad:(UIWebView *)webView { NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; title = [title stringByReplacingOccurrencesOfString:@"Apple - iOS " withString:@""]; int version = [title intValue]; // 6, 7, 8... } 
-4
source

All Articles