广告未在iOS设备上展示 [英] Ads are not showing on iOS devices

查看:102
本文介绍了广告未在iOS设备上展示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在扑朔迷离中,我们想使用AdMob。

In flutter, we want to use AdMob.

我们进行如下设置。
因为可能存在关系,所以我们也编写Firebase Analytics。

We set as follows. Because there may be relationships, we also write Firebase Analytics.

[pubspec.yaml]
dependencies:
  flutter:
    sdk: flutter

  firebase_admob: ^0.5.7
  firebase_analytics: ^1.0.3

[main.dart]
void main() {
  // [Analytics]
  FirebaseAnalytics().logAppOpen();

  // [Initialize:AdMob]
  FirebaseAdMob.instance.initialize(
    appId: Platform.isAndroid
        ? 'ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx'
        : 'ca-app-pub-yyyyyyyyyyyyyyyy~yyyyyyyyyy',
  );

  // [Create Banner Ad:AdMob]
  createBannerAd()
    ..load()
    ..show(
      anchorType: AnchorType.top,
    );

  runApp(MyApp());
}

final MobileAdTargetingInfo targetingInfo = new MobileAdTargetingInfo(
  testDevices: Const.testDevices,
  keywords: <String>[
    'foo',
    'bar',
  ],
  birthday: new DateTime.now(),
  childDirected: true,
  gender: MobileAdGender.female,
);

// [Create Banner Ad:AdMob]
BannerAd createBannerAd() {
  return new BannerAd(
    adUnitId: Platform.isAndroid
        ? 'ca-app-pub-XXXXXXXXXXXXXXXX/XXXXXXXXXX'
        : 'ca-app-pub-YYYYYYYYYYYYYYYY~YYYYYYYYYY',
    size: AdSize.banner,
    targetingInfo: targetingInfo,
    listener: (MobileAdEvent event) {
      print("BannerAd event $event");
    },
  );
}

我们下载了Firebase配置文件并将其放在下面。
在Xcode的目标成员身份中,我们确认设置正确。

We download the Firebase configuration file and place it in the following. In Xcode's Target Membership, we have confirmed that it is set correctly.

/android/app/google-services.json
/ios/Runner/GoogleService-Info.plist

它通常显示在Android设备。
但是,它不会显示在iOS设备上。
输出了以下日志。

It is displayed normally on Android device. However, it is not displayed on the iOS device. The following log was output.

2018-08-29 11:21:58.147849+0900 Runner[459:115739] FirebaseAdMobPlugin <warning> [FIRApp configure]
2018-08-29 11:21:58.157062+0900 Runner[459:115880] 5.5.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more:
[abridgement]
2018-08-29 11:21:59.755279+0900 Runner[459:115739] FirebaseAdMobPlugin <warning> adView:didFailToReceiveAdWithError: Request Error: No ad to show. (MobileAd <FLTBannerAd: 0x113ef81b0> PENDING mobileAdId:ZZZZZZZZZ for: <GADBannerView: 0x113efa7b0; frame = (0 0; 320 50); clipsToBounds = YES; layer = <CALayer: 0x113efac40>>)
2018-08-29 11:21:59.757247+0900 Runner[459:115885] flutter: BannerAd event MobileAdEvent.failedToLoad

如何在扑朔迷离中实现 [FIRApp configure];
不必要吗?在示例代码中找不到它。

How should we implement [FIRApp configure]; in the flutter? Is it unnecessary? We could not find it in the sample code.

我们的设置正确吗?
如果我们再等几天,

Is our setting correct? If we wait for a few more days, will mobileAdId not be pending?

$ flutter doctor -v
[✓] Flutter (Channel dev, v0.7.2, on Mac OS X 10.13.6 17G65, locale ja)
    • Flutter version 0.7.2 at /Applications/flutter
    • Framework revision f8a2fc7c28 (4 days ago), 2018-08-27 20:58:30 +0200
    • Engine revision af42b6dc95
    • Dart version 2.1.0-dev.1.0.flutter-ccb16f7282

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/xxxxx/src/android-sdks
    • Android NDK at /Users/xxxxx/src/android-sdks/ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = /Users/xxxxx/src/android-sdks
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4.1, Build version 9F2000
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 27.1.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] VS Code (version 1.25.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.17.1

[✓] Connected devices (1 available)
    • iPhone 6 Plus • XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX • ios • iOS 11.4.1

• No issues found!

与此问题同时,我们还与AdMob联系。
广告不会使用以下应用ID和广告单元ID显示。

In parallel with this question, we also contact AdMob. Ads will not be shown using the following app ID and ad unit ID.

ca-app-pub-3940256099942544~1458002511
ca-app-pub-3940256099942544/2934735716


推荐答案

我们尝试了几个终端。


  • [确定]华硕Z017DA(Android)

  • [确定] iPad mini

  • [确定] iPhone 4s

  • [NG] iPhone 6 Plus

  • [ NG] iPhone SE

  • [OK] ASUS Z017DA (Android)
  • [OK] iPad mini
  • [OK] iPhone 4s
  • [NG] iPhone 6 Plus
  • [NG] iPhone SE

我们尝试了各种更改,但效果不佳。但是,今天无广告显示突然停止了。但是该广告尚未显示。

We tried various changes but they were ineffective. However, today "No ad to show" suddenly ceased to occur. But the ad was not displayed yet.

我们认为广告可能会在屏幕外显示。当我们进行以下设置时,广告将显示在我们期望的位置。

We thought that ads might be displayed outside the screen. When we made the following settings, the ad was displayed in the place we expected.

_bannerAd
  ..load()
  ..show(
    anchorType: AnchorType.top,
    anchorOffset: 50.0,
  );

但是,在更改之前通常显示的终端中,广告向下移动。我们无法采用这种方法,因为我们无法尝试所有终端。

However, in the terminal normally displayed before the change, the ad was displayed shifted downward. We could not adopt this method because we can not try all the terminals.

接下来,我们将广告放置在屏幕下方。

Next, we placed the ad under the screen.

_bannerAd
  ..load()
  ..show(
    anchorType: AnchorType.bottom,
  );

在这种情况下,我们能够确认广告在所有终端上均正常显示。我们希望将广告放在顶部,但我们放弃了。

In this case, we were able to confirm that ad is displayed normally on all terminals. We wanted to place the ad on top but we gave it up.

AnchorType.top在某些情况下可能不正确。

AnchorType.top may be incorrect in some cases.

这篇关于广告未在iOS设备上展示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆