Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8905941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:31:20+00:00 2026-06-15T02:31:20+00:00

I am creating an app on cocos2d. i config the iAd but I don’t

  • 0

I am creating an app on cocos2d.
i config the iAd but I don’t know my app is crashing on device but when I run app on simulator it works fine.

Error:

[ADBannerView initWithAdType:]: unrecognized selector sent to instance  

Code:

- (void)createAdBannerView {
    Class classAdBannerView = NSClassFromString(@"ADBannerView");
    if (classAdBannerView != nil) {

        _adBannerView = [[classAdBannerView alloc] initWithAdType:ADAdTypeBanner];

        [_adBannerView setPosition:ccp([[CCDirector sharedDirector] winSize].width/2, -33)];

        [_adBannerView setDelegate:self];

        [[[CCDirector sharedDirector] view] addSubview:_adBannerView];

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:31:23+00:00Added an answer on June 15, 2026 at 2:31 am

    initWithAdType requires iOS 6.0 or above. If you are testing on an iOS 5.x device, you’ll see the crash. Use the old way of initializing ADBannerViews (e.g., initWithFrame) on older devices.

    This is the iOS 6.0 declaration for initWithAdType:

    - (id)initWithAdType:(ADAdType)type __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0);
    

    To support the old iOS5 way of creating an iAd banner, you’ll need to add:

    #import <iAd/ADBannerView_Deprecated.h>
    

    Example code:

    ADBannerView *iAdView = nil;
    if ([[ADBannerView class] instancesRespondToSelector:@selector(initWithAdType:)]) { // iOS 6.0
        iAdView = [[[ADBannerView alloc] initWithAdType:ADAdTypeBanner] autorelease];
    } else { // iOS 4.x-5.x
        iAdView = [[[ADBannerView alloc] initWithFrame:CGRectMake(0, 0, appleWidth_, appleHeight_)] autorelease];
        iAdView.currentContentSizeIdentifier = isLandscape_ ? ADBannerContentSizeIdentifierLandscape : ADBannerContentSizeIdentifierPortrait;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating app that use autocomplete places google api. And I don't know what
I'm creating a game app using cocos2d Chipmunk. The app is working normally but
I am currently creating a point and click app for the iphone using cocos2d.
I'm creating app, using IB. But File's Owner doesn't want to work! I can't
I am creating app that display route between two endpoint,this is done. But now
I'm creating app for image scan with WIA. But my images has a lot
When creating an app that will run on iPad and iPhone, how does the
I'm trying to get started with cocos2d by creating an app with a background
Creating simple app using GAE / Django-nonrel (I don't think the problem is specific
I am creating Drawing app for ipad using cocos2d-iphone its using CCRenderTexture for drawing.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.