magicalpanda / MagicalRecord

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

NSUnknownKeyException - this class is not key value coding-compliant for the key length. #1279

Closed kjmaior closed 5 years ago

kjmaior commented 7 years ago

Performing a MR_findAllSortedBy: ascending: withPredicate is resulting in application crash because of NSUnknonwKeyException. The very odd part is the same exact predicate works in one instance but causes the crash in another. An example of one such predicate is as follows:

(version == 10 AND riderClass == "A") AND eastOffPeak == 1 AND (restrictToDays == nil OR restrictToDays.length <= 0 OR restrictToDays == 0 OR restrictToDays & 2 == 2) AND (restrictToTrain == nil OR restrictToTrain.length <= 0 OR restrictToTrain == "1622") AND (restrictToJob == nil OR restrictToJob.length <= 0 OR restrictToJob == "815") AND soldOnboard == 1 AND (identifier != 9022 AND identifier != 5005)

Any other information you think would be helpful please let me know. Unfortunately I cannot recreate and my crashlytics report doesn't have magicalrecord stack trace because of missing dysym.

Thanks!

Coeur commented 5 years ago

I'm sorry, but it's too much time consuming to investigate on issues without a Minimal, Reproducible Example.

All I could say is: double check that restrictToDays, restrictToTrain and restrictToJob all can respond to length. (so, make sure for instance that it's never NSNull)