Reputation: 1733
I'm building a paid app and an accompanying lite version with iAds. The paid version now and then displays this error in the log:
2011-09-12 15:05:24.751 [29318:12b03] ViewController::bannerView didFailToReceiveAdWithError (NO ADS):Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0x61d0b60 {ADInternalErrorCode=3, NSLocalizedFailureReason=Ad inventory unavailable}
I'm a bit surprised this happens, as I am doing this to stop iAds in the paid version:
[iAdBannerView removeFromSuperview];
iAdBannerView.hidden = YES;
// (not setting) iAdBannerView.delegate = nil;
iAdBannerView = nil;
I cannot remove every reference to iAds in my app, as I have the iAd banner in a nib, and I prefer to have one nib with everything in it, for both app version. Hence the iAd framework is in my binary.
So, anyone an idea how to really stop the iAds system starting for your app when it should not?
Upvotes: 1
Views: 544
Reputation: 32066
You could use preprocessor commands to strip iAds from the paid version of your application.
In your prefix.pch you'd include something like this: #define FREE_VERSION 1
And then everywhere where you reference iAds, surround it with #if FREE_VERSION
and #endif
Upvotes: 0
Reputation: 25011
If you are to submit two separate apps to the AppStore, I would seriously consider creating a separate target for each on Xcode and user conditional compilation.
Something like this:
#ifdef FREE_VERSION
// Create iAd Banner
// add banner to superview
#endif // FREE_VERSION
That way, your paid version doesn't even have to link to the iAd framework nor you risk a a paid user seeing an ad because of a bug you introduce to the app.
Upvotes: 0