project-imas / encrypted-core-data

v2.0 - iOS Core Data encrypted SQLite store using SQLCipher
Other
785 stars 236 forks source link

Comparation between dates of model doesn't work #251

Open aleufms opened 8 years ago

aleufms commented 8 years ago

My method returns all records that doesn't have synced yet. So, I fetch the following predicate:

[NSPredicate predicateWithFormat:@"updatedAt > syncAt"]

updateAt and syncAt are NSDates.

but it doesn't returns any record, even if exists. If I use unencrypted core data it works.

hydroplosion commented 8 years ago

I am seeing this predicate problem too, but my entity attributes are timestamps that are Integer 64 typed. I haven't tried with unencrypted Core Data, but if I remove the predicate I can analyze the fetch and see the predicate should have passed.

SQL debug seems to show an 'IS' comparator instead of '>': SELECT ecdMyObject.__objectID, ecdMyObject.__entityType FROM ecdMyObject WHERE ecdMyObject.__entityType IN (1597663553, -1125698699, -1369640806, 2047603503) AND ecdMyObject.updatedAt IS ecdReading.syncAt