Search code examples
iosiad

Why my iAds ads corrupted on iPads


On iPhone all ok. On iPads iAds ads looks like corrupted. But when it loads new ads (blue, red etc..) all looks great. Where is my mistake?

// in applicationDidFinishLaunchingWithOptions

    CGSize winSize = [[CCDirector sharedDirector] viewSize];

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        adsBanner = [[ADBannerView alloc] initWithFrame:CGRectMake(0, winSize.height - 66, 768, 66)];
    }
    else
    {
        adsBanner = [[ADBannerView alloc] initWithFrame:CGRectMake(0, winSize.height - 50, 320, 50)];
    }

// somewhere in AppDelegate

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    [self.window.rootViewController.view addSubview:banner];
}

Here is image from iPad with corrupted ads:

enter image description here


Solution

  • Your question has nothing to do with iPad. Why are you initializing the ADBannerView like this? You are not using the API correctly. Use the designated initializer method initWithAdType: to get the correct result (you most likely need to use ADAdTypeBanner as the type).

    To resize to fit to a specific view, you need to use what is recommended here.