iAd横幅未显示

时间:2014-02-04 01:33:47

标签: iad

我有一个没有显示的iAd横幅。这是我的代码:

.h文件:

#import <UIKit/UIKit.h>
#import <iAd/iAd.h>

@interface PopViewController : UIViewController <ADBannerViewDelegate>
{

}
@end

.m文件

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.

}

- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:1.0];
[UIView commitAnimations];
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error     {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:0];
[UIView commitAnimations];
}

横幅根本不显示。有人可以修复此代码吗?我已经将横幅链接到文件所有者并使其成为委托。谢谢

1 个答案:

答案 0 :(得分:0)

我也见过这个代码,它对我也没用。试试这个。 Lemme知道这是怎么回事。如果它不起作用,我可以帮助你更多。

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{

    if (banner.isBannerLoaded)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        // Assumes the banner view is placed at the bottom of the screen.

        banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);
        [UIView commitAnimations];
    }


}

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{

    if (!banner.isBannerLoaded)
    {
        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
        // Assumes the banner view is just off the bottom of the screen.
        //banner.frame = CGPointMake(self.size.width/2, self.size.height);
        banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);

        [UIView commitAnimations];
    }
}