Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create instance of NSFetchedResultsController? #26

Closed
Burnsoft opened this issue Jun 2, 2011 · 2 comments
Closed

Create instance of NSFetchedResultsController? #26

Burnsoft opened this issue Jun 2, 2011 · 2 comments

Comments

@Burnsoft
Copy link

Burnsoft commented Jun 2, 2011

The fetch request seems to be ok, and the rest of the viewcontroller is a stanfard tableview with nsfetched methods throughout

Can anyone give me a hand implementing this properly? It just crashes after returning the controller...
Cheers
Nik

'- (NSFetchedResultsController *)fetchedResultsController {

NSFetchRequest *fetchRequest = [Companies requestAllSortedBy:@"name" ascending:YES];

NSFetchedResultsController *aFetchedResultsController = [Companies fetchRequest:fetchRequest 
                                                                      groupedBy:nil];

aFetchedResultsController.delegate = self;
self.fetchedResultsController = aFetchedResultsController;

[aFetchedResultsController release];
NSError *error = nil;
if (![fetchedResultsController_ performFetch:&error]) {

    NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
    abort();
}

return fetchedResultsController;

} '

@casademora
Copy link
Member

You are releasing an autoreleased object. Remove the following line:

[aFetchedResultsController release];

That should get you going. Also worth noting, use the peformFetch: category method on the NSManagedObject. It will log errors for you, making development much easier.

@Burnsoft
Copy link
Author

Burnsoft commented Jun 2, 2011

thanks! not done that in a while ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants