magicalpanda / MagicalRecord

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

Documentation recommends unsupported CoreData stuff #1055

Open jonasman opened 9 years ago

jonasman commented 9 years ago

https://github.com/magicalpanda/MagicalRecord/blob/master/Docs/Importing-Data.md

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"NOT(id IN %@)", idList];
[Person MR_deleteAllMatchingPredicate:predicate];

This code will create a predicate that could be too big for CoreData. The CoreData cannot handle sometimes big lists and returns this error:

 unimplemented SQL generation for predicate : (p_id IN {5, 12, 34, 35, 9, 30, 13, 33, 2, 11, 8, 1, 6, 3, 4, 7, 10, 31, 32})

If the idList is small enough it will work, but not with a big one like this. I recommend to fix the docs and suggest an alternative way of removing entries.

Alydyn commented 9 years ago

fix it and submit a pull request!

jonasman commented 9 years ago

yeap, im thinking in an alternative way of removing the old entries, any ideas?

jonasman commented 9 years ago

maybe fetching all first to AllArray, remove all entries from AllArray that came from the server delete all from this AllArray