My model:
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)
When I'm trying to extract ConvTexts from Conv:
Conv *c = [Conv objectsWhere:@"c_id = %@",@(1)];
ConvText *ct = [c.cts arraySortedByProperty:@"time" ascending:NO][0]; <--
I get this message: 'RLMException', reason: 'This method can only be called in RLMArray instances retrieved from an RLMRealm'
I also try like this:
RLMArray *cts = c.cts;
ConvText *ct = [cts arraySortedByProperty:@"time" ascending:NO][0];
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…