views:

201

answers:

2

I'm working on an iPhone app (first real programming project) and I had two views that would go into tabs in separate applications to build them, where they work fine. Then I added them back into the main project; The tableviews bring on a crash with an numberOfRowsInSection] unrecognized selector sent to instance 0xXXXXXX so I isolated the other view to fix any errors there first. I'm using xibs.

But on the other view, when I click a Button that triggers a custom method, I get an *** -[UIViewController methodName]: unrecognized selector sent to instance 0x####XX0 just like the last one.

What also puzzles me is that the console won't print anything else except these errors; I have NSLogs() all over the place and they're not showing up, even in the appDelegate. They do however show up when they're in the main. (Because of the application life-cycle right?: then the error gets there first and I don't see my NSLogs)

The unrecognized selector messages are logged because of methods. I have all my synthesize statements and have searched questions here, but they're not like mine (I think.)

+1  A: 

When you say you added the XIB files "back into the main project" it makes me think this is the likely area of concern.

I think it may be the case that these XIB files are still thinking they are classes in the old application (where you originally built them). I suggest:

  • Opening up each XIB file and removing all the connections
  • Then check the class name of the "file's owner" and check that this is the class in your new application. If the class names are the same in the old app as the new, change to something else and then back again.
  • Hopefully this will sort it. If it doesn't, try creating a brand new XIB file and then building it in the same way as you built the others. If this still doesn't work the problem is in the class; if you let us know then we can come back with further ideas in this area.

Hope that helps!

h4xxr
Will try; back in a bit and thanks.
JoePasq
No that's not it. :(The second view is a subclass of UIViewController, has no instance variable, and only has several methods. Each method corresponds to a button, or is a delegate call (UIAlertView....) These are attached in the xib, and everything shows up fine, but in runtime it crashes.
JoePasq
A: 

I've since removed the second view from it's xib and instead put it in the main xib, with an added UIViewController object that has it's class set to my subclass. Now it's working, and I'm moving on to the next part. I think it was that I left out UIViewController in one way or another from the xibs

As stated above, almost everything being worked out now. Thanks though and silly me for posting such a question.

JoePasq