I have a small app with iAds, and allow people to pay to upgrade.
The iAd is setup in the application's NIB. I check the purchase status in the viewDidLoad
method of the main UIViewController, and call the following methods on the ADBannerView
outlet member:
[adBanner removeFromSuperview];
adBanner = nil;
Unfortunately if I watch the device's data usage, some data is still downloaded for the Ad.
Is there any way to properly kill the iAd so it doesn't load any data?
I know I could create the iAd view programatically and then add it only if the user has not purchased the product, but my product is working nicely from the NIB and I'd rather not change it for this reason.
UPDATE:
In my .h file I have:
IBOutlet ADBannerView* adBanner;
In the .m file in - (void)viewDidLoad
method I have:
if (purchased) {
[adBanner removeFromSuperview];
adBanner.delegate = nil;
adBanner = nil;
}
I would hope this would be enough to remove the iAd before it gets a chance to download any data.
Alas, this isn't enough to prevent the view from downloading data. I suspect there is a delay in it being fully dealloc'd at that time – but I don't know how to do this, short of calling dealloc
itself.
Does anyone know of a better/correct way to completely destroy an object loaded via the XIB and assigned to an IBOutlet
?