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 4099842
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:29:20+00:00 2026-05-20T20:29:20+00:00

I have two classes, using Box2d,Cocos2d. Construct.mm and Level1.mm Construct contains all the methods

  • 0

I have two classes, using Box2d,Cocos2d.
Construct.mm and Level1.mm
Construct contains all the methods for creating different objects in the box2d physics engine
Level1 contains the information on the plotting of objects.

In the construct implementation I have:
Construct.mm

-(void) someInitMethod{  
Level1 *level1 = [[Level1 alloc] init];  
[level1 mapping];  
}  
-(void) someCreateRectMethod:(argue)ments{  
//create rect  
}

In the Level1 implementation I have:

Level1.mm

-(void) mapping{  
Construct *constr;  
if (constr == nil) constr = [[Construct alloc] init];  
[constr someCreateRectMethod:(argue)ments];  
}

Now, I know the allocation of Level1 *level1 is working fine. It jumps to -(void)mapping{
}.
My problem is in creating the Construct *constr object and initialising it. Without the if(constr == nil) statement. The simulator will die straight away, before even posting any error report.
If i put the if(constr == nil) and then try to call [constr someCreateRectMethod:arguement];

The console reports:

* Terminating app due to uncaught exception
‘NSInvalidArgumentException’, reason:
‘-[Level1 someCreateRectMethod:]: unrecognized
selector sent to instance 0x5557fc0’

I think this is because its not allocing, therefore trying to send to self (Level1) rather than Construct.
Why isnt my Construct *constr class object not allocing? Like I said, no error reporting it occurring.. I have imported the Construct.h file. I’ve spent the last 4 hours trying to get this to work.

EDIT

I just made Layer 1 inherit from Construct. And instead of calling [constr someCreateRectMethod]; I simply call [super someCreateRectMethod];
This should theoretically work, but Simulator crashes and no error reporting is logged..

Once again, Thanks for your time.
Oliver.

  • 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-05-20T20:29:21+00:00Added an answer on May 20, 2026 at 8:29 pm

    You probably don’t end up creating constr – the initial value is undefined and therefore very unlikely to be nil. If your code otherwise terminates at [[constr alloc] init] then it seems likely that you’ve failed to subclass NSObject (which you should) and not implemented init (which you often want to).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, so I have two (completely unrelated, different project) classes using iterators now. One
I am using DBContext and have two classes whose properties are all virtual. I
I am trying to serialize/deserialize JSON in Android using GSON. I have two classes
I'm trying to pass an int between two classes using a bundle. I have
I'm using play-1.2.3. I have two classes some kind of these: LabelItem: @Entity @Table(name=T_LABEL_ITEM)
I have two classes, the first called Radish and the second called RadishCont. All
I am using spring + hibernate in my project; I have two classes Reminder
I have two classes. I created a JAR file using: jar cvf practice.jar class1.class
I'm using ASP.NET MVC 3 with Entity Framework CodeFirst I have two classes as
I am using Fluent NHibernate and NHibernate.Core 3 beta 1. I have two classes:

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.