Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘Can’t create a regex expression from object 2338.’

ERROR:

2015-08-18 21:03:06.070 gno[2239:128977] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘Can’t create a regex expression from object 2338.’

Reason:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@”eventPostDBID like %@”, self.eventPostID];

NSArray *abc = [[appDelegate.timelineManager.timelineDic objectForKey:self.eventID] filteredArrayUsingPredicate:predicate];

Solution:

Change:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@”eventPostDBID like %@”, [[theResults objectAtIndex:i] objectForKey:@”eventPostDBID”]];

To:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@”eventPostDBID == %@”, [[theResults objectAtIndex:i] objectForKey:@”eventPostDBID”]];

This Error just because the “eventPostDBID like %@” was not the valid NSPredicate term.