EXC_BAD_ACCESS when trying to build string by using %@ for an int

Viewed 3098

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?

2 Answers
Related