I have tried both these NSPredicate
s:
let predicate = NSPredicate(format: “personID == %lld", id)
let predicate = NSPredicate(format: “personID == %d", id)
I enabled SQL logging and saw this at the end of the SQL query:
WHERE t0.ZPERSONID = ?
In variables view, id
has a value of Int64(156)
, but regardless of what I put in place of id
, the resulting SQL query has t0.ZPERSONID = ?
for its WHERE clause. Because of this, the predicate is useless and I’m getting duplicate record insertions every time. How do I get t0.ZPERSONID = 156
?