這個賞金已經結束。此問題的答案有資格獲得 100聲望獎勵。賞金寬限期將在7 小時后結束。 彼得正在尋找信譽良好的來源的答案。
在我的 Admob 實施方面,我遇到了一些嚴重的問題。我遵循了官方檔案,但是玩了一會兒我的游戲后,手機開始變得非常熱,過了一會兒,應用程式突然變得非常緩慢和滯后,最終崩潰。
我 100% 肯定這是由于展示了大量 Admob 插頁式廣告。由于應用程式在沒有它們的情況下可以完美運行。
我承認,如果你玩一段時間,就會顯示很多廣告,但關閉它們不是一個選項,因為它是應用程式的主要收入來源。
這是我用來加載和顯示廣告的代碼:
- (void)loadInterstitial {
[GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-xxx/xxx" request:[GADRequest request] completionHandler:^(GADInterstitialAd *ad, NSError *error) {
if (error) {
NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);
return;
}
self.interstitial.fullScreenContentDelegate = nil;
self.interstitial = ad;
self.interstitial.fullScreenContentDelegate = self;
}];
}
- (void)displayInterstitial {
if (self.interstitial) {
[self.interstitial presentFromRootViewController:self];
adCount = 0;
[[NSUserDefaults standardUserDefaults] setInteger:adCount forKey:@"adCount"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else {
NSLog(@"Ad wasn't ready");
}
}
- (void)adDidDismissFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {
[self loadInterstitial];
}
沒什么特別的。在我看來,在顯示大量插頁式廣告后,記憶體似乎過載了,是否有某種方法可以在顯示后處理它們?
uj5u.com熱心網友回復:
您需要interstitial在新請求之前清除舊:
- (void)loadInterstitial {
self.interstitial.fullScreenContentDelegate = nil;
self.interstitial = nil;
[GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-xxx/xxx" request:[GADRequest request] completionHandler:^(GADInterstitialAd *ad, NSError *error) {
if (error) {
NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);
return;
}
self.interstitial = ad;
self.interstitial.fullScreenContentDelegate = self;
}];
}
uj5u.com熱心網友回復:
可能與增加記憶體中的 WKWebView 實體有關?我遇到過類似奇怪的 Google Ad Manager 原生廣告行為。有詳細資訊:https : //issuetracker.google.com/issues/198511570
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/388196.html
上一篇:查找相似匹配項時如何在find()方法中使用變數?[復制]
下一篇:在字典串列中查找重復值
