I have simple predicate like this to fetch all Code objects from Core Data:
let predicate = NSPredicate(format: "code.state != %@ AND code.validity != %d AND code.validity < %ld", "ACCEPTANCE", 0, Date().timeIntervalSince1970 * 1000)
Now inside cellForRow
I am printing what I have:
print("++++++++++")
print(product.code)
print(product.code?.state)
let a = product.code?.validity ?? 0
print(a)
print(Date().timeIntervalSince1970 * 1000)
print(Double(a) < Date().timeIntervalSince1970 * 1000)
And then I have the following result:
code.state != "ACCEPTANCE" AND code.validity != 0 AND code.validity < 4789427390557216924
++++++++++
aaa
Optional("PACKED")
1614253260000
1612447824663.5361
false
++++++++++
product test 5
Optional("PACKED")
1616880420000
1612447824672.909
false
++++++++++
Produkt testowy 1
Optional("UNPACKED")
1611788400000
1612447824678.4438
true
++++++++++
qqq
Optional("UNPACKED")
1612306800000
1612447824702.927
true
++++++++++
test phone 2
Optional("UNPACKED")
1612393200000
1612447824718.4958
true
As you can see two of them are printed as false. So why they are fetched while they didnt?
question from:
https://stackoverflow.com/questions/66047436/nspredicate-doesnt-work-for-long-long-values 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…