开发者

nspredicate multiple items from an array

开发者 https://www.devze.com 2023-03-09 06:08 出处:网络
how to use NSPredicate to satisfy multiple conditions NSEntityDescription *entity = [NSEntityDescription entityForName:@\"MessageData\" inManagedObjectContext:managedObjectConte开发者_如何学编程xt];

how to use NSPredicate to satisfy multiple conditions

NSEntityDescription *entity = [NSEntityDescription entityForName:@"MessageData" inManagedObjectContext:managedObjectConte开发者_如何学编程xt];
    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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消