Why is iAd still loading data after it has been removed from it, and can it be stopped?

I have a small application with iAds and let people pay for the update.

iAd is configured in the NIB application. I check the purchase status in the viewDidLoad method of the main UIViewController and call the following methods in the ADBannerView member:

 [adBanner removeFromSuperview]; adBanner = nil; 

Unfortunately, if I observe the use of device data, some data is still being downloaded for the ad.

Is there a way to kill iAd correctly so that it does not load data?

I know that I could create an iAd representation programmatically, and then add it only if the user did not purchase the product, but my product works fine with NIB, and I do not want to change it for this reason.

UPDATE:

In my .h file, I have:

 IBOutlet ADBannerView* adBanner; 

In the .m file in - (void)viewDidLoad I have:

 if (purchased) { [adBanner removeFromSuperview]; adBanner.delegate = nil; adBanner = nil; } 

I would hope that this would be enough to remove the iAd before it gets the opportunity to download any data.

Alas, this is not enough to prevent data loading. I suspect that at this time there is a complete delay, but I do not know how to do this without calling dealloc myself.

Does anyone know a better / correct way to completely destroy an object loaded via XIB and assigned by IBOutlet ?

+4
source share
4 answers

I suspect that you have not fully issued an ad banner.

Did you create adBanner auto-repeat when you created it? If you haven’t done so, the code that you display here does not properly issue the banner.

Most likely, you did not auto-implement it and save it. What you need to do:

 [adBanner release]; 

instead

 adBanner = nil; 

which, by the way, is useless since it only sets the adBanner pointer to nil , but does not free the object at all.

+4
source

I think you will have to use the second thread without the iAd banner. The nib loading process will create all the elements of the element before passing control back to your objects. This is why you cannot prevent iAd from trying to load an ad.

First duplicate the current icon and simply delete the iAd banner view. Then override the controller initWithNibName:bundle: to check the status of the payment. If paid, change the nib name to a non iAd nib and call the superclass method with another nib.

+1
source

You can also set adBanner.delegate = nil to prevent the adBanner community from delegating with it.

0
source

@ mr-berna is right because you need to conditionally load the iAd view. You can do what it offers and use a second tip or create a programmatic view of iAd.

0
source

All Articles