EXC_BAD_ACCESS when building nspredicate

The issue is the placeholder, not with NSPredicate directly, but with initWithFormat: that is innerly called.

%@ shouldn’t be used with an int, use %d instead.

So this line:

NSPredicate *pred = [NSPredicate predicateWithFormat:@"(alter_min_monat > %@)", months];

Should be:

NSPredicate *pred = [NSPredicate predicateWithFormat:@"(alter_min_monat > %d)", months];

Other linked information : String Programming Guide: String Format Specifiers

Leave a Comment