【发布时间】:2017-03-27 13:55:41
【问题描述】:
我有这样的 JSON。
livefeeds= {
"-KTn8pbqFHBUvgJ1Gwyl" = {
category = Alerts;
text = "Samsung Galaxy Note 7 owners told to turn off device";
timestamp = 1476179485648;
"user_id" = V7EFBV6uATf8urLXX9eK4EHhxmG2;
};
"-KTn8pbrhHyNzeLh2vOq" = {
category = News;
text = "Chicago Teachers Union, school board reach tentative contract agreement";
timestamp = 1476179485648;
"user_id" = V7EFBV6uATf8urLXX9eK4EHhxmG2;
};
}
我需要根据键category进行查询。
例如:如果我只想要警报,它应该只检索等于“警报”数据的类别值。
这是检索livefeeds的查询。
[[self.ref queryOrderedByChild:@"livefeeds"] observeEventType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {
NSLog(@"---> %@",snapshot.value);
}];
【问题讨论】:
标签: ios objective-c firebase firebase-realtime-database