To satisfy your curiosity you can use the iTunes Search API:
NSData *jsonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://itunes.apple.com/lookup?id=412828831"]]; // add &country=XX for specific country, default is US
if (jsonData) {
NSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
NSArray *results = json[@"results"];
NSDictionary *firstResult = [results firstObject];
NSLog(@"\"%@\" is currently available for %@(%@)", firstResult[@"trackName"], firstResult[@"formattedPrice"], firstResult[@"price"]);
}
In your real app you can check if the bundle identifier matches to the identifier of your ad-supported app:
if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.myname.myapp.withAds"]) {
// show ads
}
else {
// don't show ads
}
You want to avoid to send useless requests to the network. That costs battery life and in some cases (contracts that have a volume limit) money. The bundle identifier would be the better choice.
I would hardcode it completely by using preprocessor macros. Because in this case I don't have to deliver advertising frameworks. Apple started to reject apps that use the advertisingIdentifier without displaying ads. And shipping an advertising SDK, which uses the advertisingIdentifier (i.e. any advertising SDK), with an app that is not supposed to display ads might lead to rejection.