I have an app with two versions, one free and one paid. I use the same code with two different targets and I have preprocessor macro which defines a variable, so that way I can know when to load or not the ads.
This has been working fine so far, until today that Apple rejected my paid version because it has the advertising Identifier used by libGoogleAdMobAds.a
I include the lib, but never use it on the paid version, because no ads is shown, but if I don't show ads, they rejects the app because of this.
The problem that I'm having is that I don't know how to compile my paid version without the admob lib when I'm including this lib in several files for my free app.
So, how can I organize my files to include admob files and include them on the free version but when compiling paid version leave them out of the binary and be able to compile my app?
Thanks
Quick Update: This is an example of how I got my code:
#import <UIKit/UIKit.h>
#import "GADBannerView.h"
#import "GADBannerViewDelegate.h"
<other imports here>
@interface testController : UITableViewController <GADBannerViewDelegate>{
GADBannerView *bannerView_;
}
I tried the following:
#import <UIKit/UIKit.h>
#ifdef FREE_VERSION
#import "GADBannerView.h"
#import "GADBannerViewDelegate.h"
#endif
<other imports here>
@interface testController : UITableViewController <GADBannerViewDelegate>{
GADBannerView *bannerView_;
}
So, I can't use the ifdef there, because if I use it on the imports, on the "interface" line, I get a not defined "GADBannerViewDelegate"
You have 2 versions, so I guess you should have 2 different targets, 1 for free app and another for paid version, so firstly you should only add admob lib to target of free app. Then secondly is use below code to show admob for free version only
#ifdef FREE_VERSION
// #import admob and show ad
#endif
Code in this ifdef condition will not be complied for paid version
[Update] You can use below code for delegate
#ifdef FREE_VERSION
#import abmob
#define ARGS admobDelegate
#endif
@interface DetailViewController : UIViewController<ARGS>