I wanted to check if a field contains data or not. Here’s my code:
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:
@"( SeriesStudyID == %@ )" ,"" ]];
But it crashes. Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
@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 achar*. Thus, you need to simply add an@sign in front of the double quotes to turn it from achar*into anNSString.