this is my NSMutableArray format and this is working fine and am getting correct response also
[
{
"status":"not completed",
"rating":2
},{
"status":"completed",
"rating":2
},{
"status":"not completed",
"rating":"<null>"
},{
"status":"completed",
"rating":"<null>"
},{
"status":"not completed",
"rating":"<null>"
}
]
and code is
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self.status == 'completed' and self.rating == NULL"];
NSArray *arr = [order filteredArrayUsingPredicate:predicate];
but in some case my NSMutableArray may change to this form
[
{
"status":not completed,
"rating":2
},{
"status":not completed,
"rating":2
},{
"status":not completed,
"rating":4
}
]
now my code is crashing here
NSArray *arr = [order filteredArrayUsingPredicate:predicate];
i have attached console screen here
crash
THERE WAS A MISTAKE IN CODE LIKE
before it was NSDictionary *jorder = response;
to use predicate i converted this to NSMutableArray *jorder = response;
Crash saying
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary filteredArrayUsingPredicate:]: unrecognized selector sent to instance 0x13f209b60'
*** First throw call stack:
(0x1841e6db0 0x18384bf80 0x1841edc4c 0x1841eabec 0x1840e8c5c 0x1001354ac 0x100135278 0x1000aaf4c 0x1001549cc 0x100e55a7c 0x100e55a3c 0x100e5b4e4 0x18419cd50 0x18419abb8 0x1840c4c50 0x1859ac088 0x1893ae088 0x100125798 0x183c628b8)
libc++abi.dylib: terminating with uncaught exception of type NSException