从节点内的节点读取数据Realm iOS

时间:2017-05-24 11:52:59

标签: ios objective-c firebase firebase-realtime-database realm

我是Realm的新手,我正在尝试将Realm与Firebase集成。我正在使用谓词使用领域获取数据。

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"isArchived == NO AND userId == %@", [User userId]];
RLMResults *dbrecents = [[Recent objectsWithPredicate:predicate] sortedResultsUsingProperty:FRECENT_LASTMESSAGEDATE ascending:NO];

和我的firebase数据结构,

Firebase structure

我的Recent对象具有与firebase结构完全相同的值,

@property NSString *objectId;
@property NSString *userId;
@property NSString *groupId;
@property NSString *initials;
@property NSString *picture;
@property NSString *description;
@property NSString *members;
@property NSString *password;
@property NSString *type;
@property NSString *fullname;
@property NSString *senderName;
@property NSInteger counter;
@property NSString *lastMessage;
@property NSTimeInterval lastMessageDate;
@property BOOL isArchived;
@property BOOL isDeleted;
@property BOOL message_me;
@property NSTimeInterval createdAt;
@property NSTimeInterval updatedAt;

当我检索数据时,dbrecents为空。我该如何解决这个问题?

0 个答案:

没有答案