Originally created by @netbe on GitHub (Nov 14, 2016).
Hi,
I am upgrading our project to 2.1.3, and seeing some failures like:
❗ [CoreStore: Assertion Failure] DataStack+Observing.swift:90 monitorList
↪︎ An 'NSFetchedResultsController' requires a sort information. Specify from a 'OrderBy' clause or any custom 'FetchClause' that provides a sort descriptor.
Most of the time, I see it because the fetchClauses contains OrderBy() only without any argument. Specifying the order then works fine, but not leaving it out
I am just wondering why the init on OrderBy is then public if it cannot be used or in which case it can be used at all.
Thanks
Originally created by @netbe on GitHub (Nov 14, 2016).
Hi,
I am upgrading our project to 2.1.3, and seeing some failures like:
```
❗ [CoreStore: Assertion Failure] DataStack+Observing.swift:90 monitorList
↪︎ An 'NSFetchedResultsController' requires a sort information. Specify from a 'OrderBy' clause or any custom 'FetchClause' that provides a sort descriptor.
```
Most of the time, I see it because the fetchClauses contains OrderBy() only without any argument. Specifying the order then works fine, but not leaving it out
**Failed**
```[Where()]```
```[Where(), OrderBy()]```
**Worked**
```[Where(), OrderBy(.Descending(ManagedPhysician.Keys.fullName.rawValue))]```
I am just wondering why the init on OrderBy is then public if it cannot be used or in which case it can be used at all.
Thanks
@netbe For ListMonitor, the OrderBy is required to have at least one sort key. Few reasons I left the default initializers public:
fetchAll(), deleteAll() also accepts OrderBy clauses, and are perfectly fine with empty sorting
NSFetchRequest.predicate and NSFetchRequest.sortDescriptors both accept nil and empty predicate/array. The effect of either is undocumented so I left a way to set both nil and their Where() and OrderBy() empty counterparts
Where() and OrderBy() can be used to explicitly express that the predicate and sort order are intentionally set to empty (as opposed to having forgot to set them)
@JohnEstropia commented on GitHub (Nov 15, 2016):
@netbe For ListMonitor, the OrderBy is required to have at least one sort key. Few reasons I left the default initializers public:
- `fetchAll()`, `deleteAll()` also accepts `OrderBy` clauses, and are perfectly fine with empty sorting
- `NSFetchRequest.predicate` and `NSFetchRequest.sortDescriptors` both accept `nil` and empty predicate/array. The effect of either is undocumented so I left a way to set both `nil` and their `Where()` and `OrderBy()` empty counterparts
- `Where()` and `OrderBy()` can be used to explicitly express that the predicate and sort order are intentionally set to empty (as opposed to having forgot to set them)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @netbe on GitHub (Nov 14, 2016).
Hi,
I am upgrading our project to 2.1.3, and seeing some failures like:
Most of the time, I see it because the fetchClauses contains OrderBy() only without any argument. Specifying the order then works fine, but not leaving it out
Failed
[Where()][Where(), OrderBy()]Worked
[Where(), OrderBy(.Descending(ManagedPhysician.Keys.fullName.rawValue))]I am just wondering why the init on OrderBy is then public if it cannot be used or in which case it can be used at all.
Thanks
@JohnEstropia commented on GitHub (Nov 15, 2016):
@netbe For ListMonitor, the OrderBy is required to have at least one sort key. Few reasons I left the default initializers public:
fetchAll(),deleteAll()also acceptsOrderByclauses, and are perfectly fine with empty sortingNSFetchRequest.predicateandNSFetchRequest.sortDescriptorsboth acceptniland empty predicate/array. The effect of either is undocumented so I left a way to set bothniland theirWhere()andOrderBy()empty counterpartsWhere()andOrderBy()can be used to explicitly express that the predicate and sort order are intentionally set to empty (as opposed to having forgot to set them)@netbe commented on GitHub (Nov 17, 2016):
@JohnEstropia thx for the explanation