Alpinista
Alpinista

Reputation: 3741

NSFetchedResultsController problem

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

Upvotes: 0

Views: 275

Answers (3)

Alpinista
Alpinista

Reputation: 3741

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

Jk

Upvotes: 2

Ian Henry
Ian Henry

Reputation: 22423

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.

Upvotes: 2

lyonanderson
lyonanderson

Reputation: 2035

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

Upvotes: 0

Related Questions