Closed benzle closed 11 years ago
I think a more accurate fix for this would be:
- (void)destroyAllAdBanners{
NSArray *instances = [self.adapterInstances allValues];
for (id <TOLAdAdapter> adapterInstance in instances) {
if (adapterInstance.adVisible) {
[self animateBannerForAdapterHidden:adapterInstance withCompletion:^{
[self cleanUpAdAdapter:adapterInstance];
}];
}
else{
[self cleanUpAdAdapter:adapterInstance];
}
}
[self.adapterInstances removeAllObjects];
}
Either way, you're right - this is missing some cleanup for the purpose that this method will be used for. I also don't think that the ad container should remove itself from its superview. I believe that should be the responsibility of the view or view controller that is hosting this.
Closing this as the change was already made in master.
Hi Larsacus:
Thanks for your sharing. I have possible code changes.
(void)destroyAllAdBanners{ NSArray *instances = [self.adapterInstances allValues];
for (id adapterInstance in instances) {
if (adapterInstance.adVisible) {
[self animateBannerForAdapterHidden:adapterInstance withCompletion:^{
//[self cleanUpAdAdapter:adapterInstance]; /* should cleanUP no matter it's visible or not*/
}];
}
}
[self.adapterInstances removeAllObjects]; / to remove it from superview, so later you'r ad will pop up if you call [[LARSAdController sharedManager] addAdContainerToViewInViewController:self]; / [_containerView removeFromSuperview];
}