NSPredicate format string doesn't work
问题 In my code, I want to check and see if a record already exists, so I know whether to create it or update it. But I ran into a problem. The problem is when I use this: NSPredicate *pred = [NSPredicate predicateWithFormat:@"%@ == %@", ATTRIBUTE_ID, idNumber]; [request setPredicate:pred]; This doesn't work. It always claims no results were found. However, it works just fine when I rewrite it like so: NSExpression *lhs = [NSExpression expressionForKeyPath:ATTRIBUTE_ID]; NSExpression *rhs =