14

シミュレーターで Admob をテストしているときに、以下のエラーがスローされます

このデバイスでテスト広告を取得するには、次のように呼び出します。 request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil];

マイコード

bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView_.adUnitID = @"8de66ecc3525495d";

bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

GADRequest *request = [[GADRequest alloc] init];
request.testing = YES;
[bannerView_ loadRequest:request];

アーカイブするように案内してください。前もって感謝します..

4

6 に答える 6

5

最後にバグの友達を修正..

adUnitIDの生成を間違えました。だから私だけが広告ビューを取得できません。

ここで、テスト用に xxxx サイトから1 つのadUnitIDを取得します。そして、その正常に動作..

adUnitID = @"a14dccd0fb24d45";

すべてのサポーターに感謝します。

于 2013-10-23T20:26:55.917 に答える
2

これは私のために働く:

(GADRequest *)request {
  GADRequest *request = [GADRequest request];
  // Make the request for a test ad. Put in an identifier for the simulator as well as any devices
  // you want to receive test ads.
  request.testDevices = @[
    // TODO: Add your device/simulator test identifiers here. Your device identifier is printed to
    // the console when the app is launched.
    GAD_SIMULATOR_ID
  ];
  return request;//thanks
}  
于 2014-07-24T06:22:10.643 に答える
0

私は現在これを使用しています。シミュレーターでも機能します。エラーが発生しましたが、エラーではありません。広範囲に検索したところ、より有益なメッセージであることがわかりました。

主なポイントは、テスト モードが NO に設定されている場合に実際の広告を表示し、テスト モードが YES に設定されている場合に「成功、広告銀河を旅する準備ができました」というメッセージを取得することです。したがって、どちらかの結果がアプリに表示されていれば問題ありません。:)

私のコードは次のとおりです。

GADBannerView *bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

bannerView_.adUnitID = GOOGLE_UNIT_ID;

GADRequest *request = [GADRequest request];

bannerView_.delegate = self;

bannerView_.rootViewController = self;

// Make the request for a test ad. Put in an identifier for
// the simulator as well as any devices you want to receive test ads.
request.testDevices = [NSArray arrayWithObjects:
                       GAD_SIMULATOR_ID,
                       nil];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];

テストを YES に設定しませんでした。Google AdMobs SDK のバージョンは 6.5.1 です

本番環境でヘルプが必要だとおっしゃっていたので、とにかくテスト モードに設定するべきではありません。そのため、おそらくテスト モードなしで実行する必要があります。

シミュレーターで実行するか実機で実行するかは問題ではないという質問を見ると、両方のデバイスで実行する必要があります。コードでデリゲートを self に設定したため、同じことを行う場合は、次のメソッドを使用できます。

- (void) adView: (GADBannerView*) view didFailToReceiveAdWithError: (GADRequestError*) error
- (void) adViewDidReceiveAd: (GADBannerView*) view

これらは、シミュレーターで実行している場合でも、広告をまったく受け取ったかどうかを確認するのに役立ちます.

お役に立てれば!:)

于 2013-10-23T02:30:43.967 に答える