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

  • SEARCH
  • Home
  • 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 8265091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:40:46+00:00 2026-06-08T04:40:46+00:00

So I have been trying to create a menu for a game I have

  • 0

So I have been trying to create a menu for a game I have developed.
I am using Cocos2d and the game is set in portrait orientation. The menu.m file that I have written looks like this.

// Import the interfaces
#import "Menu.h"
#import "BankerInfo.h"

// HelloWorldLayer implementation
@implementation MenuLayer

+(CCScene *) scene
{
    // 'scene' is an autorelease object.
    CCScene *scene = [CCScene node];

// 'layer' is an autorelease object.
MenuLayer *layer = [MenuLayer node];

// add layer as a child to scene
[scene addChild: layer];

// return the scene
return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    // ask director the the window size
    CGSize winSize = [[CCDirector sharedDirector] winSize];

    CCSprite *menubackground = [CCSprite spriteWithFile:@"Ninja Menu Background.png"];
    menubackground.position = ccp(winSize.width/2, winSize.height/2);
    [self addChild:menubackground z:-1];


    CCLabelTTF *title = [CCLabelTTF labelWithString:@"Catch It If You Can!"             fontName:@"Zapfino" fontSize:22];
    title.position =  ccp(160, 420);
    [self addChild: title];

    CCLayer *menuLayer = [[CCLayer alloc] init];
    [self addChild:menuLayer];

    CCMenuItem *Bankerbutton = [CCMenuItemImage
                               itemFromNormalImage:@"Bankernotpressed.png"
                               selectedImage:@"Bankerpressed.png"
                               target:self
                               selector:@selector(startBanker:)];
    //Bankerbutton.position = ccp(100, 175);

    CCMenuItem *Babybutton = [CCMenuItemImage
                                 itemFromNormalImage:@"Babynotpressed.png"
                                 selectedImage:@"Babypressed.png"
                                 target:self
                                 selector:@selector(startBaby:)];
    //Babybutton.position = ccp(100, 75);
    CCMenuItem *Mommaduckbutton = [CCMenuItemImage
                              itemFromNormalImage:@"Mommaducknotpressed.png"
                              selectedImage:@"Mommaduckpressed.png"
                              target:self
                              selector:@selector(startMommaduck:)];
    //Mommaduckbutton.position = ccp(350, 175);
    CCMenuItem *Baseballbutton = [CCMenuItemImage
                                itemFromNormalImage:@"Baseballnotpressed.png"
                                selectedImage:@"Baseballpressed.png"
                                target:self
                                selector:@selector(startArcher:)];
    //Baseballbutton.position = ccp(350, 75);
    CCMenuItem *Newtonbutton = [CCMenuItemImage
                                  itemFromNormalImage:@"Newtonnotpressed.png"
                                  selectedImage:@"Newtonpressed.png"
                                  target:self
                                  selector:@selector(startArcher:)];
    //Newtonbutton.position = ccp(350, 75); 

    CCMenu *menu = [CCMenu menuWithItems: Bankerbutton, Babybutton, Mommaduckbutton,         Baseballbutton, Newtonbutton, nil];
    menu.position = ccp(winSize.width/2, (winSize.height/2)-30);
    [menu alignItemsInRows:
     [NSNumber numberWithInt:2], [NSNumber numberWithInt:2], nil];
    [menuLayer addChild: menu];

}
return self;
}

- (void) startBanker: (id) sender
{
[[CCDirector sharedDirector] replaceScene:[BankerInfoLayer scene]];
}
/*- (void) startBaby: (id) sender
{
[[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Soldier scene]];
}
- (void) startMommaduck: (id) sender
{
[[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Mage scene]];
}
- (void) startBaseball: (id) sender
{
[[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Archer scene]];
}
- (void) startNewton: (id) sender
{
[[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Archer scene]];
}
*/
// on "dealloc" you need to release all your retained objects
- (void) dealloc
{
// in case you have something to dealloc, do it in this method
// in this particular example nothing needs to be released.
// cocos2d will automatically release all the children (Label)

// don't forget to call "super dealloc"
[super dealloc];
}
@end

And the error I’m getting looks like this.

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '+[NSInvocation invocationWithMethodSignature:]: 
method signature argument cannot be nil'

Any Ideas?

  • 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-08T04:40:47+00:00Added an answer on June 8, 2026 at 4:40 am

    The error states that thi is happening because of a bad call to an unexisting method signature. If you provide the functions used on the menu creation, does it still crash?

    STEP 1: Make sure that the baseball button and newton button direct to the right selector, and not just the “startArcher:” that doesnt exist.

    CCMenuItem *Baseballbutton = [CCMenuItemImage
                                itemFromNormalImage:@"Baseballnotpressed.png"
                                selectedImage:@"Baseballpressed.png"
                                target:self
                                selector:@selector(startBaseball:)]; // CHANGED HERE
    //Baseballbutton.position = ccp(350, 75);
    CCMenuItem *Newtonbutton = [CCMenuItemImage
                                  itemFromNormalImage:@"Newtonnotpressed.png"
                                  selectedImage:@"Newtonpressed.png"
                                  target:self
                                  selector:@selector(startNewton:)]; // CHANGED HERE
    

    STEP 2: Uncomment the functions so you actually have valid selectors

    - (void) startBanker: (id) sender
    {
        [[CCDirector sharedDirector] replaceScene:[BankerInfoLayer scene]];
    }
    - (void) startBaby: (id) sender
    {
        [[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Soldier scene]];
    }
    - (void) startMommaduck: (id) sender
    {
        [[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Mage scene]];
    }
    - (void) startBaseball: (id) sender
    {
        [[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Archer scene]];
    }
    - (void) startNewton: (id) sender
    {
        [[CCDirector sharedDirector] replaceScene:[Backgroundinfo_Archer scene]];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to create a menu panel with jQuery that can be
I have been trying to create a ListView which I can sort using drag
I have been trying to create an observable tweeter feed using tweetsharp with the
I have been trying to create an XML using the simplexml library (v2.6.2) http://simple.sourceforge.net/home.php
I have been trying to create a simple application that will let the user
I have been trying to create a post login script that will change the
I have been trying to create beta invites that each existing user can send
I have been trying to create a simple calculator. Using PHP I managed to
I have been trying to create a new google custom search engine, but when
I have been trying to create a simple program with Python which uses OpenCV

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.