Swift 3 Core Data - NSExpression forFunction: “sum:” throws error (“could not cast dictionary to Day”)
问题 I have days and tasks. A day has many tasks. Every task has an attribute called "points" and I want to sum all points of the tasks of the current day. I used the code below (found in the book Core Data by tutorials, swift 2 version) and tried to modify it for swift 3 (I also added a predicate, but that's not important). But when I run this code, I get this error: Could not cast value of type 'NSKnownKeysDictionary1' (0x10d02d328) to 'MyProject.Day' What am I doing wrong? // sum current day's