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

Already on GitHub? Sign in to your account

fetchAllWithDelegate: causes application crash #348

Closed
huix9527 opened this Issue Dec 21, 2012 · 6 comments

Comments

Projects
None yet
5 participants

MRCategory is a simple core data entity in my case, which contains only one field: categoryName, I added the following line in my code:

[MRCategory fetchAllWithDelegate:self]

The application crashes, judging by the output:
'An instance of NSFetchedResultsController requires a fetch request with sort descriptors'
It seems that a sort descriptor needs to be set to the request before constructing the NSFetchedResultsController.

Owner

casademora commented Dec 21, 2012

Yes, this method was added by mistake. Please don't use it, it will be
removed in the next update.

Thanks

Sent from my iPad

On Dec 21, 2012, at 8:45 AM, huix9527 notifications@github.com wrote:

MRCategory is a simple core data entity in my case, I added the following
line in my code:

[MRCategory fetchAllWithDelegate:self]

The application crashes, judging by the output:
'An instance of NSFetchedResultsController requires a fetch request with
sort descriptors'
It seems that a sort descriptor needs to be set to the request before
constructing the NSFetchedResultsController.


Reply to this email directly or view it on
GitHubhttps://github.com/magicalpanda/MagicalRecord/issues/348.

Thanks for the quick response. By calling [MRCategory fetchAllSortedBy:@"categoryName" ascending:YES withPredicate:nil groupBy:nil delegate:self]; also meets my needs.

@huix9527 huix9527 closed this Dec 21, 2012

jschmid commented Feb 25, 2014

This method has still not been removed. I happened to use it and found this issue which is "closed".

It would be nice to at least mark it as deprecated. 👍

Owner

casademora commented Feb 25, 2014

Yeah, we’re working on a few different things at the moment. 3.0 should clean some stuff up

On Feb 25, 2014, at 2:12 PM, Jonas Schmid notifications@github.com wrote:

This method has still not been removed. I happened to use it and found this issue which is "closed".

It would be nice to at least mark it as deprecated.


Reply to this email directly or view it on GitHub.

This method seems valid to me and useful. Instead I have to manually deal with FRC. What is the problem to keep and fix this method? I might be wrong but it seems to me as a good way to monitor a light-weight table for changes.

NSFetchRequest *fetchRequest = [OptionModel MR_createFetchRequest];
fetchRequest.sortDescriptors = @[];

self.optionsFetchedResultsController = [OptionModel MR_fetchController:fetchRequest delegate:self useFileCache:NO groupedBy:nil inContext:[NSManagedObjectContext MR_defaultContext]];
[self.optionsFetchedResultsController performFetch:nil];

NSInvalidArgumentException', reason: 'An instance of NSFetchedResultsController requires a fetch request with sort descriptors'

I am Facing this problem in my application to connect CoreData in Swift 3.0.1 so friend any to help me for this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment