For the use within Core Data I tried to build a NSPredicate object. minLength and maxLength are of typeint:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"length >= %@ AND length <= %@",
minLength, maxLength];
The program crashes here with an EXC_BAD_ACCESS. This is not the case if I use %d instead of %@:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"length >= %d AND length <= %d",
minLength, maxLength];
What am I missing here?
%@is the format specifier for objects. Anintis not an object. The format specifier for signed integers is%dor%i.