iOS [iAD] Screen Freezes After Closing Full Screen Ad

StrongJoshua

macrumors newbie
Original poster
Mar 23, 2014
3
0
SOLVED: I had to remove the call to enable ad display
Code:
self.canDisplayBannerAds
because it interfered with my self-created banner.

Ok, so after testing on the simulators it turns out that this issue is only occurring on actual devices... How would I fix this?
______________________________________________________________
Hello :)
So I'm developing an iOS app and am implementing iAD. Everything works like it should, except whenever I close a full screen ad (after opening it by clicking on the banner) the screen freezes... The app is still running because if I click the banner and close out of it again the screen refreshes like normal and I can see that that the game progressed. I have no clue what could be causing this... Here is the code I have to initialize the banner ad and the methods for it (all in the Ad Delegate within my view controller). I am using the Spritekit framework btw.
The initialization:
Code:
self.canDisplayBannerAds = YES;

CGRect bannerFrame = CGRectMake(0, 20, scene.size.width, 50);
    
banner = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner];
banner.delegate = self;
banner.frame = bannerFrame;
[banner setAlpha:0];
[self.view addSubview:banner];
Now the methods:
Code:
- (void) bannerViewDidLoadAd:(ADBannerView *) bannerM
{
    NSLog(@"Ad Loaded");
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [bannerM setAlpha:1];
    [UIView commitAnimations];
}

- (void) bannerView:(ADBannerView *)bannerM didFailToReceiveAdWithError:(NSError *)error
{
    NSLog(@"Ad Failed");
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [bannerM setAlpha:0];
    [UIView commitAnimations];
}

- (BOOL) bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
    if(playing)
    {
        NSLog(@"Ad Pause");
        [((WBPlayScene *)((SKView *)self.originalContentView).scene).logic pause:YES];
    }
    return YES;
}

- (void) bannerViewActionDidFinish:(ADBannerView *)banner
{
    if(playing)
    {
        NSLog(@"Ad Unpause");
        [((WBPlayScene *)((SKView *)self.originalContentView).scene).logic pause:NO];
    }
}
Any help would be very much appreciated!

Thanks in advance,
StrongJoshua
 
Last edited:

Zaneku

macrumors newbie
Mar 30, 2014
2
0
[iAD] Screen Freezes After Closing Full Screen Ad

How StrongJoshua,

I'm having the same problem. How did you fix it. I didn't understand. Please help.

Thanks
 

StrongJoshua

macrumors newbie
Original poster
Mar 23, 2014
3
0
How StrongJoshua,

I'm having the same problem. How did you fix it. I didn't understand. Please help.

Thanks
Basically, you cannot create your own banner and tell the view controller that it is allowed to display ads. You must choose one or the other (creating your own is usually best because you can customize how, where, and when it should appear).
 

Zaneku

macrumors newbie
Mar 30, 2014
2
0
[iAD] Screen Freezes After Closing Full Screen Ad

Hi StrongJoshua

Thanks you for your reply. I have removed the "self.canDisplayBannerAds" and left the self-created banner. I have submitted the new update to Apple and waiting for the review. There is no way of testing this until it goes live. I hope this works.

Apple is taking too long to review :(

Thank you for your help.
 

StrongJoshua

macrumors newbie
Original poster
Mar 23, 2014
3
0
Hi StrongJoshua

Thanks you for your reply. I have removed the "self.canDisplayBannerAds" and left the self-created banner. I have submitted the new update to Apple and waiting for the review. There is no way of testing this until it goes live. I hope this works.

Apple is taking too long to review :(

Thank you for your help.
Of course you can test it. Just load the app onto your iDevice like you would normally when creating your app. Xcode will generate fake ads that you can click on to test your code!