0

我正在使用 IOS Google Admob SDK 6.11.1 和 Xcode 5.1。

我的示例代码警告

如果我认为loadrequest是替代品,loadanddisplayrequest但不是。

[splashInterstitial_ loadRequest:[GADRequest request]];

因为仅使用 loadrequest 不会出现插页式广告。

loadAndDisplayRequest这个方法有效,但我想知道这个不推荐使用的方法的替代品是什么。

4

2 回答 2

0

您需要presentFromRootViewController:在收到插页式广告后致电:

#pragma mark - GADInterstitialDelegate
- (void)interstitialDidReceiveAd:(DFPInterstitial *)ad
{
    [splashInterstitial_ presentFromRootViewController:self];
}  
于 2014-08-18T13:18:30.060 回答
0

在 appdelegate 中使用此代码。它对我有用。

 - (void)applicationDidBecomeActive:(UIApplication *)application
    {


        GADRequest *request = [GADRequest request]; // here you need to crate object of GADRequest
        interstitial_ = [[GADInterstitial alloc] init];
        interstitial_.adUnitID =@"ca-app-pub-43434/343434";
        interstitial_.delegate = self;
    //    request.testDevices = [NSArray arrayWithObjects:
    //                           @"MY_SIMULATOR_IDENTIFIER",
    //                           @"fbb99fa8c725017137fb191a20aa342491b82a37",
    //                           nil];

        [interstitial_ loadRequest:request];

    }


    - (void)interstitial:(GADInterstitial *)interstitial
    didFailToReceiveAdWithError:(GADRequestError *)error {


        NSLog(@"==%@",[error localizedDescription]);


    }

    -(void)interstitialWillPresentScreen:(GADInterstitial *)ad{
        NSLog(@"on screen");
    }
    - (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {

        //   [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

        [interstitial presentFromRootViewController:self.window.rootViewController];


        // [interstitial presentFromRootViewController:self];


    }
于 2015-01-22T04:09:56.690 回答