I´ve a quite "simple" predicate for a NSFetchRequest:
guard let kategorie = self.fetchedResultsController.objectAtIndexPath(indexPath) as? Kategorien else {
return
}
let fetchRequest = NSFetchRequest(entityName: "Details")
fetchRequest.predicate = NSPredicate(format: "kategorie == %i", kategorie.katid!)
do {
let results = try self.managedObjectContext.executeFetchRequest(fetchRequest) as! [Details]
...
The content of the sqllite-"table" is

the content of the variables are

So from
fetchRequest.predicate = NSPredicate(format: "kategorie == %i", kategorie.katid!)
i get the Predicate
kategorie == 18
while
kategorie.katid is 1
I can´t understand it :-(
Any help???
That's really strange, but you can just do:
NSPredicate(format: "kategorie = \(kategorie.katid!)")
And then you don't need to worry about whether you need a %i, or a %ld, or a %@, etc...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With