如何编写 NSPredicate 来获取 id 位于数组中的所有项目?
在我的核心数据数据库中,每个项目都有一个字符串 id,它是一个 url,指示该项目属于谁。
现在我有一个数组,其中包含 200 个所有者 url(200 只是一个示例,它在应用程序中是动态的)。我希望获取属于 200 个自己的 url 的所有项目。
如果只有 1 个所有者 url,我知道如何编写:
[NSPredicate predicateWithFormat:@"(ownerUrl == %@)", url]
所有者 url 数组怎么样,比如 200 个?
顺便说一句,我使用的核心数据是sql。我认为 sql 会忽略 NSPredicate 中的 "IN" ?
谢谢
In my core data db, every item has a string id which is an url to indicate whom this item belongs to.
Now I have an array which contains, say, 200 owner urls (200 is just an example, it is dynamic in the app). I wish to fetch all items that belong to the 200 own urls.
If only 1 owner url, I know how to write:
[NSPredicate predicateWithFormat:@"(ownerUrl == %@)", url]
What about an array of owner urls, say 200?
by the way, the core data I am using is sql. I think sql will ignore "IN" in NSPredicate?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this :