Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nspredicate multiple items from an array

how to use NSPredicate to satisfy multiple conditions

NSEntityDescription *entity = [NSEntityDescription entityForName:@"MessageData" inManagedObjectContext:managedObjectContext];
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    [fetchRequest setEntity:entity];
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"msg_id = %@",msg_id];

    [fetchRequest setPredicate:predicate];

i need to fetch objects in which msg_id = values in a array

like image 556
sujith1406 Avatar asked May 31 '11 14:05

sujith1406


1 Answers

You can do "msg_id IN %@", array.

like image 177
Deepak Danduprolu Avatar answered Nov 09 '22 14:11

Deepak Danduprolu