Why nspredicate crash?

I wanted to check if the field contains data or not. Here is my code:

[fetchRequest setPredicate:[NSPredicate predicateWithFormat:
                            @"( SeriesStudyID ==  %@ )" ,"" ]];

But he is falling. Why?

+3
source share
1 answer

@iAnand the answer is incorrect. Using %@predicate strings is perfectly acceptable.

The problem is what the %@replacement in the object means, but you substitute in ""which is not an object, but char*. So you just need to add the character @before the double quotation marks to turn it from char*to NSString.

+4
source

All Articles