2

So this is the code which worked in Xcode 9.2:

let request: NSFetchRequest<MyModel> = MyModel.fetchRequest()
request.predicate = NSPredicate(format: "saved = %@", true as CVarArg)

and after update to Xcode 9.3 and Swift 4.1, the code crashes:

Thread 1: EXC_BAD_ACCESS (code=1 , address=0x1)

This is the part which crashes

NSPredicate(format: "saved = %@", true as CVarArg)

The saved property of a MyModel entity is declared as boolean. Why this started happening but it worked before ?

Whirlwind
  • 14,286
  • 11
  • 68
  • 157

1 Answers1

3

You don't have to overcomplicate it, if you're always looking for saved = true then just use a string literal in your predicate.

NSPredicate(format: "saved == true")
rodfleischer
  • 320
  • 5
  • 9