Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding admob to an iPhone app with cocos2d make the game crash...?
    primarykey
    data
    text
    <p>I'm working on a cocos2d game on iPhone. The game work perfectly.<br> Now I want to add an admob ad in the menu of my game. I can see the ad, but after few seconds (or minutes) of playing, the game crash (with no error message...)<br> Can you see where the problem is? </p> <p>Menu.h </p> <pre><code>@interface Menu : CCColorLayer &lt;AdMobDelegate&gt; { AdMobView *adMobAd; NSTimer *refreshTimer; } </code></pre> <p>Menu.m </p> <pre><code>+(id) scene {...} -(id) init {...} -(void) dealloc {...} - (void)didReceiveAd:(AdMobView *)adView { adMobAd.frame = CGRectMake(-260, 432, 320, 48); CGAffineTransform makeLandscape = CGAffineTransformMakeRotation(M_PI * 0.5f); makeLandscape = CGAffineTransformTranslate(makeLandscape, -216, -134); adMobAd.transform = makeLandscape; [[[CCDirector sharedDirector] openGLView] addSubview:adMobAd]; [refreshTimer invalidate]; refreshTimer = [NSTimer scheduledTimerWithTimeInterval:AD_REFRESH_PERIOD target:self selector:@selector(refreshAd:) userInfo:nil repeats:YES]; } - (UIViewController *)currentViewController { return nil; } - (void)onEnter { adMobAd = [AdMobView requestAdWithDelegate:self]; [adMobAd retain]; [super onEnter]; } - (void)onExit { [adMobAd removeFromSuperview]; [adMobAd release]; [super onExit]; } - (void)refreshAd:(NSTimer *)timer { [adMobAd requestFreshAd]; } - (NSString *)publisherId { return @"zzzzzzzzzzzzzz"; } - (UIColor *)adBackgroundColor { return [UIColor colorWithRed:0.2 green:0.6 blue:1 alpha:1]; } - (UIColor *)primaryTextColor { return [UIColor colorWithRed:1 green:1 blue:1 alpha:1]; } - (UIColor *)secondaryTextColor { return [UIColor colorWithRed:1 green:1 blue:1 alpha:1]; } - (BOOL)mayAskForLocation { return NO; } </code></pre> <p>Thanks! :-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload