2

我正在尝试使用该ABPerson方法searchElementForProperty:...创建一个中等复杂的搜索。特别是,我想找到具有以“ foo.com”结尾的电子邮件地址并且不属于预填充组“ My workunit”的一组人。

仅匹配电子邮件地址似乎很简单。创建与组成员关系(的倒数)的合取似乎是不可能的。

是的,我可以通过自己进行明显的明确交叉检查来做到这一点,但是如果直接在地址簿中具有搜索功能的目的是优化性能,那么搜索工具是否足够完整以能够去做这个?

在此先感谢,托尼

4

2 回答 2

1

You could potentially copy all the data from the address book into a Core Data store and use predicates to work with that data. Predicates tend to be very useful when building complex queries.

Predicate Programming Guide

In this case you would have to get all contacts ([[AddressBook sharedAddressBook] people]) and also have a Core Data entity called Contact (or something similar) that would save names, emails, addresses and other properties from the ABPerson object.

Having this you can probably create an NSPredicate to filter with the conditions you want.

于 2012-09-11T12:22:44.103 回答
0

组根据 recordId 引用其成员。我发现执行这种操作的唯一方法是:如何找到一个人的父组。这不是我们想要的简单的事情。苹果似乎并不关心非常有用的组搜索。

于 2013-10-04T21:20:54.517 回答