【发布时间】:2014-08-11 11:00:48
【问题描述】:
假设我有一个 Dog 和 Person 领域对象,例如
@interface Dog : RLMObject
@property NSString *name;
@property NSInteger age;
@property RLMArray<Person> *owners;
@end
@implementation Dog
@end
RLM_ARRAY_TYPE(Dog)
@interface Person : RLMObject
@property NSString *name;
@property RLMArray<Dog> *dogs;
@end
@implementation Person
@end
RLM_ARRAY_TYPE(Person)
这是来自 Realm 示例项目的示例代码。唯一的区别是Dog 实体有一个Person 对象数组作为owners,换句话说,与Person 的dogs 成反比关系。
现在我要完成的事情是查询具有Person 作为owners 之一的Dog 对象。
我该怎么做?
【问题讨论】:
标签: ios objective-c relationship realm