Reputation: 6451
I wanted to check if a field contains data or not. Here's my code:
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:
@"( SeriesStudyID == %@ )" ,"" ]];
But it crashes. Why?
Upvotes: 3
Views: 737
Reputation: 243156
@iAnand's answer is wrong. Using %@
in a predicate format string is perfectly acceptable.
The problem is that %@
means to substitute in an object, but you're substituting in ""
, which is not an object, but a char*
. Thus, you need to simply add an @
sign in front of the double quotes to turn it from a char*
into an NSString
.
Upvotes: 4