magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.79k forks source link

Setting ascending to NO causes the MR_fetchAllSortedBy to return data in random order #1094

Open 1nput0utput opened 9 years ago

1nput0utput commented 9 years ago

I am not sure wether my query is wrong or something in MagicalRecord. Here's my fetchedResultController: let predicate = NSPredicate(format: "(ArticleAttributes.published_at.rawValue) >= %@", NSDate().dateBySubtractingDays(20)) let fetchController = Article.MR_fetchAllSortedBy("published_at", ascending: false, withPredicate: predicate, groupBy: nil, delegate: nil)

The first page in my tableview is properly ordered, but when I fetch the next page, the NSFetchedResultsControllerDelegate fail to insert new rows because the indices are all in wrong order. If I set the ascending to true, my tableview gets populated using NSFetchedResultsControllerDelegate, but I want my most recent article on top.