私はオンラインで、StackOverflowで同じまたは類似のエラーメッセージを持つ検索記事を見つけましたが、誰も私と同じバグを持っていません。それらは異なる条件を持っています。つまり、さまざまな状況でエラーメッセージが表示されたり、iOSなどの別のバージョンに表示されたりします。オンラインで見つかったすべてのソリューションを試しました。Google Admobのライブ広告は実際のデバイスのiOS 11に表示されません
基本的には、私のiOSアプリでバナー広告とインタースティシャル広告を表示するためにAdmobを使用しています。これらはライブアプリで1年以上実行されていますが、現在はiOS 10デバイスやそれ以前のバージョンのiOSで問題なく動作しています。
しかし、iOSをiOS11にアップデートすると、物事が変更されました。
テスト広告は、iOSのすべてのバージョンでシミュレータと実際のデバイスで動作します。ライブ広告は、iOSのすべてのバージョンのシミュレータで動作します。ライブ広告はiOS 10の実際のデバイスで動作しますが、iOS 11の実際のデバイス(iOS 11のiPhone SE)では動作しません。これは、店舗からダウンロードしたライブアプリの場合も同様です。
それは私がバナー広告やインタースティシャル広告については、以下のエラーメッセージが表示されますため、iOSの11
で新しい何かにでなければなりません。
「adView:didFailToReceiveAdWithError:リクエストエラー:表示するはありません広告を。 」
は、私は以下の私のコードを紹介します。
を私はまた、アプリを再インストールしようとしました。私のAdWordsアカウントに私は私の課金情報を更新しようとしたと私は広告トラッキング制限が無効になっていることをチェックしました。私もupdatを試したiOS 11がリリースされた今、私の広告の実装が完了しました。まだ動作しません。現在、最新バージョンのSDK、Google Mobile Ads SDKのバージョン:afma-sdk-i-v7.26.0を使用しています。
これは、iOS 10デバイスのライブアプリで問題なく実行されているオリジナルのコードです。
-(void)implementGoogleBannerAds
{
self.googleBannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
self.googleBannerView.adUnitID = @"ca-app-pub-4170137185945186/3406302758";
self.googleBannerView.rootViewController = self;
self.googleBannerView.delegate = self;
// Place the ad view onto the screen.
[self.view addSubview:self.googleBannerView];
[self.googleBannerView loadRequest:[GADRequest request]];
self.googleBannerView.hidden=NO;
}
iOS11の[入門ノート]でAdmobのコードを更新しましたが、これは何も変更されませんでした。これはシミュレータとiOS10の実デバイスでは動作しますが、実際のiOS 11デバイスでは動作しません。
-(void)implementGoogleBannerAds
{
self.googleBannerView = [[GADBannerView alloc]
initWithAdSize:kGADAdSizeSmartBannerPortrait];
self.googleBannerView.adUnitID = @"ca-app-pub-4170137185945186/3406302758";
self.googleBannerView.rootViewController = self;
[self.googleBannerView loadRequest:[GADRequest request]];
self.googleBannerView.delegate = self;
}
-(void)adViewDidReceiveAd:(GADBannerView *)adView {
NSLog(@"adViewDidReceiveAd");
self.googleBannerView.hidden=NO;
[self addBannerViewToView:self.googleBannerView];
}
-(void)addBannerViewToView:(UIView *)bannerView {
NSLog(@"addBannerViewToView");
bannerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:bannerView];
if (@available(ios 11.0, *)) {
// In iOS 11, we need to constrain the view to the safe area.
[self positionBannerViewFullWidthAtBottomOfSafeArea:bannerView];
} else {
// In lower iOS versions, safe area is not available so we use
// bottom layout guide and view edges.
[self positionBannerViewFullWidthAtBottomOfView:bannerView];
}
}
-(void)positionBannerViewFullWidthAtBottomOfSafeArea:(UIView *_Nonnull)bannerView NS_AVAILABLE_IOS(11.0) {
// Position the banner. Stick it to the bottom of the Safe Area.
// Make it constrained to the edges of the safe area.
UILayoutGuide *guide = self.view.safeAreaLayoutGuide;
[NSLayoutConstraint activateConstraints:@[
[guide.leftAnchor constraintEqualToAnchor:bannerView.leftAnchor],
[guide.rightAnchor constraintEqualToAnchor:bannerView.rightAnchor],
[guide.bottomAnchor constraintEqualToAnchor:bannerView.bottomAnchor]
]];
}
-(void)positionBannerViewFullWidthAtBottomOfView:(UIView *_Nonnull)bannerView {
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeLeading
multiplier:1
constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView
attribute:NSLayoutAttributeTrailing
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeTrailing
multiplier:1
constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:bannerView
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.bottomLayoutGuide
attribute:NSLayoutAttributeTop
multiplier:1
constant:0]];
}
制限広告追跡がオン(設定/プライバシー/広告)の場合、通常iPhoneの広告は表示されません。 –
@AmodGokhaleありがとうございましたが、私はすでに広告の制限を無効にしていることを確認しました。だから問題はこれではありません。 – Nikolaus
私はAdmobに直接連絡しなければなりませんでした。テストしていた実際のデバイスはiPhone SEでしたが、現在のところ、このデバイスでは広告はまだ動作していません。私はまだ彼らがなぜこれが私に戻ってくるのを待っています。しかし、広告は実際のiPhone 6、iPhone 6 plus、iPhone 8で動作しているようです!だから我々はそれがほとんどの携帯電話に影響していない彼らの側のバグだと結論づけた。うまくいけば、彼らは結局これを解決するでしょう! – Nikolaus