如果我希望有一个具有相同用户模型的Realm数组,则会发生异常。 RLMException(@"RLMArray properties require a protocol defining the contained type - example: RLMArray<Person>.");
那么是否有解决方法?如何在Realm中实现递归关系如下?Realm模型中的递归关系
#import <Realm/Realm.h>
@interface User : RLMObject
@property NSInteger userId;
@property NSString *displayName;
@property RLMArray<User> *friends;
- (instancetype)initWithDictionary:(NSDictionary *)data;
@end
RLM_ARRAY_TYPE (User)
领域文档说,我们应该在模型界面的底部添加宏。 是的,前向声明是除了在顶部添加宏之外的解决方案。谢谢你。 –