我想知道是否有人可以幫助以下。我已將iAd和AdMob集成到我的應用中。但是,用戶報告說該應用在iPod Touch上崩潰。在xCode中使用工具我已經設法識別出某個名爲「GOOGLE_SHUFFLE_RVS_User_waylonis_Code_afma1_googlmac_iPhone_GoogleAds_Signals_Protected_build_GoogleAdsSignals_build_Release_iphoneos_Google」的內容在每次調用時會導致大約500個字節的內存泄漏。我的廣告刷新率設置爲20秒,因此每20秒發生一次。在iPhone上的Admob集成 - 內存泄漏問題
我的代碼如下。
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
if (self.bannerIsVisible)
{
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
// banner is visible and we move it out of the screen, due to connection issue
banner.frame = CGRectOffset(banner.frame, 0, -90);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
[self loadAdMobAd];
}
-(void)loadAdMobAd {
if (!bannerView_) {
CGRect adSize = CGRectMake (0,40,0,0);
adSize.size = GAD_SIZE_320x50;
bannerView_ = [[GADBannerView alloc] initWithFrame:adSize];
bannerView_.rootViewController = self;
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];
}
}
想法是,如果iAd不可用,AdMob廣告會被加載。
我的代碼有什麼問題可能導致泄漏?
非常感謝,
馬丁
謝謝。它泄漏較少,但仍然泄漏。每次請求丟失100字節? – GuybrushThreepwood 2011-04-12 19:43:19