MoPub横幅广告未显示

时间:2014-05-25 18:07:39

标签: objective-c uiviewcontroller mopub

我试图让MoPub横幅广告出现。我已经创建了一个UIViewController,并将MoPub代码放入View中,因此加载了它。

- (id)init
{
    self = [super init];

    if (self) {
        // Custom initialization
    }
    return self;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    // ... your other -viewDidLoad code ...
    self.adView = [[MPAdView alloc] initWithAdUnitId:@"ID HERE"
                                                 size:MOPUB_BANNER_SIZE];
    self.adView.delegate = self;
    CGRect frame = self.adView.frame;
    CGSize size = [self.adView adContentViewSize];
    frame.origin.y = [[UIScreen mainScreen] applicationFrame].size.height - size.height;
    self.adView.frame = frame;
    [self.view addSubview:self.adView];
    [self.adView loadAd];
    //[super viewDidLoad];


}

#pragma mark - <MPAdViewDelegate>
- (UIViewController *)viewControllerForPresentingModalView {
    return self;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

在我的AppDelegate中,我设置了所有内容(这是一个麻雀游戏)

 //setup Sparrow
    CGRect screenBounds = [UIScreen mainScreen].bounds;
    _window = [[UIWindow alloc] initWithFrame:screenBounds];

    _gcViewController = [[UIViewController alloc]init];

    _viewController = [[SPViewController alloc] init];

    [_viewController startWithRoot:[Game class] supportHighResolutions:YES doubleOnPad:YES];

    _viewController.multitouchEnabled = YES;

    [_window setRootViewController:_viewController];

    adViewController = [[AdViewController alloc]init];
    [_window addSubview:adViewController.view];

    [_window addSubview:_gcViewController.view];

    [_window makeKeyAndVisible];

在控制台中,我似乎正在获得正确的消息......

  

寻找名为MPHTMLBannerCustomEvent的自定义事件类。 MOPUB:   加载MoPub HTML横幅MOPUB:MoPub HTML横幅加载

但是我在模拟器的屏幕上看不到任何想法?

0 个答案:

没有答案