我将如何创建一个NSPredicate按类的实体进行过滤Contact?
NSPredicate 检查对象类崩溃的解决方案:
[NSPredicate predicateWithFormat:@"person.class == %@", [Contact class]];
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'keypath person.class not found in entity <NSSQLEntity User id=12>'
背景
我有核心数据实体User(应用程序用户)和Contact(通讯录联系人),都是Person(抽象实体)的孩子。Person有很多identities, 可以是emails, phones, 或usernames.
要创建一个类似文本消息的预输入,我想创建一个NSFetchRequestfor Identityentity where personis of class Contact。