tags:

views:

99

answers:

3

Hi -

When I try to set up a cell in a UITableViewController that has a NSFetchedResultsController I am getting an error as soon as I try to get to the managedObject. The error is:

2009-12-08 16:21:47.610 Take10[4837:20b] *** NSInvocation: warning: object 0xa08dd140 of class 'List' does not implement methodSignatureForSelector: -- trouble ahead
2009-12-08 16:21:47.610 Take10[4837:20b] *** NSInvocation: warning: object 0xa08dd140 of class 'List' does not implement doesNotRecognizeSelector: -- abort

Here is my code, crash comes when trying to set up the managed object:

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

// Get the managedObject
NSManagedObject *managedObject = [fetchedResultsController objectAtIndexPath:indexPath];

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// Set up the cell...
cell.textLabel.text = [managedObject valueForKey:@"listName"];

return cell;
}

I've looked at the class code for the managedBobject that is retrieved by the fetch, and it looks fine, an automatically generated class from my Core Data model. If I use another entity from the model in the same fetch, all works perfectly.

Ideas??

Thanks

A: 

I'd always used the actual Entity class that was retrieved -- looks like "List" in your case -- rather than calling it an NSManagedObject (List *list = [fetchedResultsController objectAtIndexPath:indexPath]). I wouldn't suspect that just from the error message, but it's the only thing that looked off to me.

Edit: This is unlikely to be the problem, but it's my last guess -- you're sure you imported "List.h"? Otherwise it could think it's just 'id'. The methods its complaining about are implemented in NSObject, so I can't imagine that they aren't there.

Ian Henry
Yeah, I tried that, but the error is the same. It knows the managed object is of type List, but thinks there is a problem with the class for some reason.
Alpinista
A: 

Does your model class inherit from NSObject? This error usually happens when this is not the case.

lyonanderson
When you create your class from the model editor it should inherit from NSManagedObject by default.
lyonanderson
Yep, the class is of type NSManagedObject. The two other entities in the model work fine. Might I have caused a problem when pre-populating the table in the SQLLite dB??
Alpinista
Possibly, does it work from a clean database?
lyonanderson
Tried that just now, no joy.
Alpinista
A: 

Found the problem: the class name List is invalid. I changed it to CheckList and all is well.

Jk

Alpinista