0
A
回答
2
夫特2
FIRDatabase.database().reference().child("events").queryOrderedByChild("id").queryEqualToValue(4).observeSingleEventOfType(.Value, withBlock: {(Snap) in
if let snapDict = Snap.value as? [String:AnyObject]{
for each in snapDict{
print(each.0) // Will print out your node ID = 1
print(each.1) //Will print out your Dictionary inside that node.
}
}
})
夫特3
FIRDatabase.database().reference().child("events").queryOrdered(byChild: "id").queryEqual(toValue: 4).observeSingleEvent(of: .value, with: {(Snap) in
if let snapDict = Snap.value as? [String:AnyObject]{
for each in snapDict{
print(each.0) // Will print out your node ID = 1
print(each.1) //Will print out your Dictionary inside that node.
}
}
})
+0
接受此爲答案,如果它解決了您的問題:)快樂編碼 – Dravidian
+0
什麼是安靜的代碼。它真的幫助了我。 非常感謝 – Aleksandar
1
可能會解決你的問題
[self.dbRef observeEventType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {
if (![snapshot.value isKindOfClass:[NSNull class]]) {
NSArray *arrResponse = (NSArray *)snapshot.value;
NSPredicate *pred = [NSPredicate predicateWithFormat:@"id = %@", serchID];
NSArray *arrSearchedVal = [arrResponse filteredArrayUsingPredicate:pred];
}
}];
NB: DBREF是你FIRDatabaseReference,這返回整個數據JSON。然後用您的搜索ID使用NSPredicate,您將得到您的結果。
編碼愉快..
+0
WC ...很高興爲您提供幫助.. –
相關問題
- 1. Firebase複雜查詢 - iOS Swift
- 2. 包含值的Firebase查詢
- 3. Firebase查詢獲取值
- 4. iOS 5.1 Monotouch查看質詢
- 5. 查詢Firebase的最有效方式iOS
- 6. iOS中的Firebase刪除查詢swift
- 7. iOS的firebase-數據庫查詢
- 8. 在angularjs中觀看Firebase查詢
- 9. Firebase按比例排序的查詢
- 10. Firebase AND查詢
- 11. containedIn查詢Firebase
- 12. Firebase查詢Android
- 13. Swift Firebase查詢
- 14. firebase 3.0查詢
- 15. 在iOS問題中展開Firebase查詢
- 16. 具有部分匹配值的Firebase iOS查詢數據
- 17. Firebase iOS查詢未按預期方式訂購
- 18. 有價值的孩子的Firebase查詢
- 19. 使用python-firebase查詢Firebase
- 20. 按不同節點的價值查詢$ UID的Firebase訂單
- 21. Firebase時間戳值和查詢|的JavaScript
- 22. 單個值更新的Firebase查詢
- 23. Firebase數據庫 - 按ID列表查詢
- 24. Android的FIrebase-按價值查詢不起作用
- 25. 在iOS中爲選定值查詢Firebase Swift
- 26. Couchdb查看查詢
- 27. 查看SQL查詢
- 28. 查看SQL查詢
- 29. 查詢與查看
- 30. Firebase查詢數據
您準確使用哪種語言? Obj-C還是Swift?您的標籤有點混亂... – Dravidian