此代码正在泄漏:
self.adView = ADBannerView* tempAddBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
self.adView.frame = CGRectOffset(adView.frame, 0, 416);
self.adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
self.adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
[self.view addSubview:adView];
self.adView.delegate = self;
self.bannerIsVisible = NO;
显然是因为 adView 从未被释放。最好的释放地点在哪里?
我修复它的尝试崩溃了:
ADBannerView* tempAddBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
tempAddBannerView.frame = CGRectOffset(adView.frame, 0, 416);
tempAddBannerView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
tempAddBannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
self.adView = tempAddBannerView;
[tempAddBannerView release];
[self.view addSubview:adView];
self.adView.delegate = self;
self.bannerIsVisible = NO;