nspredicate数组中的多个项 [英] nspredicate multiple items from an array

查看:108
本文介绍了nspredicate数组中的多个项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用NSPredicate来满足多个条件

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];

我需要获取对象,其中msg_id =数组中的值

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

推荐答案

您可以msg_id IN%@,数组

这篇关于nspredicate数组中的多个项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆