views:

305

answers:

2

I've got a really annoying problem, and as much as I've searched, I can't find the answer. My app is terminating when I try to view a TableView. The data source and delegate is set to the File's owner, which implements the protocol.

alt text

alt text

The error I'm getting looks like this:

[Session started at 2010-02-27 16:28:24 +0000.]
2010-02-27 16:28:27.209 Moola[28564:207] Unknown class FirstViewController in Interface Builder file.
2010-02-27 16:28:28.189 Moola[28564:207] *** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5005900
2010-02-27 16:28:28.190 Moola[28564:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5005900'
2010-02-27 16:28:28.190 Moola[28564:207] Stack: (
    40692267,
    2469430537,
    40961963,
    40426854,
    40423522,
    4542959,
    4550376,
    4549359,
    3202411,
    3139508,
    3189226,
    3176954,
    68444159,
    68443501,
    68441542,
    68440628,
    68472982,
    40444146,
    40231701,
    40228984,
    49023565,
    49023762,
    2840157,
    9184,
    9038
)

Finally, here's the implementation file (SettingsController.m) of the SettingsController class:

alt text

I'm sure this is a trivial problem for a pro, but I come from a highly web-based background, and only dabbled in C a while a few years back. To be truthful, it's hurting my head.

Thanks,

Jamie

+2  A: 

What is FirstViewController as referenced in this disconcerting log line? Could it be some leftover reference that Interface Builder is actually trying to instantiate instead of your SettingsController?

2010-02-27 16:28:27.209 Moola[28564:207] Unknown class FirstViewController in Interface Builder file.
quixoto
It was left over after the project template. I've looked across the IB files but can't find where it's being referenced. The class files have been deleted. Do you think that could be the problem?
Jamie Rumbelow
Sure, could be. I would hunt that down and make doubly sure the references point to SettingsController. Your implementation certainly looks present, so my guess is that the wrong thing is being instantiated-- the warning is a strong clue.
quixoto
Got it. The FirstViewController was being instantiated by a separate tab (in my Tab Bar.) Not sure why it was complaining though, it had nothing to do with it. Anyway, it's working now. Thanks a lot.
Jamie Rumbelow
A: 

Are you sure that the receiver is indeed a SettingsController? Try

NSLog(@"receiver's type: %@", NSStringFromClass([foo class]));

just before the call that fails (and of course change "foo" to whatever the receiver's actual name is).

Frank Shearar