1
firebase DBにあるユーザーの特定の値を保存しようとしています。私がデータを理解できる唯一の方法は、userIDをキーとして使用することです。ここで私はfirebaseに値を格納する際にuserIDをキーとして使用できません
https://firebaseDB/user_orders/userID達成しようとしているものです - >リスト(注文)を
しかし、私はキーとしてユーザーIDを使用しようとすると、私は
2016-を言って、エラーを取得しています0835 17:56:10.479 BetMe [4322:84427] *** 未知の例外 'NSUnknownKeyException'の理由でアプリケーションを終了しています:理由: '[setValue:forUndefinedKey:]: このクラスは、キー 3ISnq916LBdmmv7330ELByxCHV33 '
は、ここに私のコードスニペットで
let orderRef = rootRef.child("user_orders")
orderRef.observeEventType(FIRDataEventType.Value, withBlock: { (snapshot) in
//
if(!snapshot.hasChild(self.currentUser.uid))
{
orderRef.setValue("", forKey: self.currentUser.uid)
}
orderRef.child(self.currentUser.uid)
})
orderRef.observeEventType(FIRDataEventType.Value, withBlock: { (snapshot) in
for order in orders
{
//
if(!snapshot.hasChild(order.betId)){
orderRef.setValue(order.dictionaryRepresentation(), forKey: order.betId)
}
}
})
私を助けてください!
どうもありがとう :) – Kanishka