Saturday, December 11, 2010

using NSPredicate with a set of answers

Programmer Question

I have a set of strings containing personIDs and I have a NSFetchedResults of people managedObjects with unique strPersonIDs. I tried to create an NSPredicate but it fails. Any help with this would be greatly appreciated. I'm a bit new to NSPredicate so be kind.



NSSet *zipSet = [NSSet setWithSet:[self getziplist:searchText]];
searchString = [NSString stringWithFormat:@"(strPersonID IN %@)",zipSet];
NSPredicate *searchPersonPredicate = [NSPredicate predicateWithFormat:searchString];


The runtime error message is: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "(strPersonID IN {(
300040,
300082,
412218
)})"'



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails