sujith1406
sujith1406

Reputation: 2822

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

Upvotes: 5

Views: 2216

Answers (1)

Deepak Danduprolu
Deepak Danduprolu

Reputation: 44633

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

Upvotes: 13

Related Questions