【发布时间】:2014-09-17 10:36:28
【问题描述】:
我的模特:
Conv.h
#import <Realm/Realm.h>
#import "ConvText.h"
@interface Conv : RLMObject
@property NSInteger c_id;
@property RLMArray<ConvText> *cts;
@end
ConvText.h
#import <Realm/Realm.h>
@interface ConvText : RLMObject
@property NSInteger ct_id;
@property NSInteger time;
@end
RLM_ARRAY_TYPE(ConvText)
当我尝试从 Conv 中提取 ConvTexts 时:
Conv *c = [Conv objectsWhere:@"c_id = %@",@(1)];
ConvText *ct = [c.cts arraySortedByProperty:@"time" ascending:NO][0]; <--
我收到此消息:'RLMException',原因:'此方法只能在从 RLMRealm 检索到的 RLMArray 实例中调用'
我也这样尝试:
RLMArray *cts = c.cts;
ConvText *ct = [cts arraySortedByProperty:@"time" ascending:NO][0];
【问题讨论】:
标签: ios objective-c realm