3

我正在尝试让 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 横幅

但是我在模拟器的屏幕上看不到任何东西,有什么想法吗?

4

0 回答 0