写入Firebase iOS

时间:2018-06-08 05:31:54

标签: ios firebase firebase-realtime-database nodes

我使用swift-我知道将数组保存到firebase不是最好的主意。但我已经实施并遇到问题所以我需要回溯。是否有任何机构对我如何能够提出建议

这就是我的数组目前在Firebase中保存的方式。

planits
 -LEQfNxgZZtg1qtlOzly
 dates
   0: "Jun 12, 2018 at 5:30 PM"
   1: "Jun 7, 2018 at 5:30 PM"
 images
   0: "https://img.evbuc.com/https%3
   1: "https://img.evbuc.com/https%3
 plans
   0: "SoulfulofNoise The Tour @ Pomona (CANCELLED)"
   1: "Just what you needed"
 senderId
   0: "ZjtJdkjzuxc0mZn4u9TfWsXa9jh2"
 title: "hey lets meet up"

这是我的初始化函数,将被调用以将数据发送到Firebase

    func uploadPlanit(withPlanTitle plans: [String], withPlanDate date: [String], withTitle title: String, forUID uid: [String], withImageStrings images: [String], sendComplete: @escaping (_ status: Bool) -> ()) {


        _REF_PLANITS.childByAutoId().updateChildValues(["plans": plans, "dates": date, "title": title, "senderId": uid, "images": images])
            sendComplete(true)



    }

这是我的应用程序中的一个类,我调用这个数据函数 - 正如你所看到的 - 我的问题是我将数组传递给函数。任何帮助,将不胜感激。谢谢

 DataService.instance.uploadPlanit(withPlanTitle: FirstViewController.nameOfIndividualEvent as! [String], withPlanDate: FirstViewController.planDateLink as! [String], withTitle: nameOfPlanItTitle!, forUID: [(Auth.auth().currentUser?.uid)!], withImageStrings: FirstViewController.planImageLinks as! [String]) 

EDIT_!我试图以这种格式重组它

planits     
LE2DSLfkxN093N
         ZTOlj8EAFD
          dates: "Jun 12, 2018 at 5:30 PM"
          images: "https://img.evbuc.com/https%3
          plans:  "Just what you needed"
        ZTUL9UF93JF
          dates: "Jun 12, 2018 at 5:30 PM"
          images: ""https://img.evbuc.com/https%3
          plans: "SoulfulofNoise The Tour @ Pomona (CANCELLED)"
        title: "hey lets meet up"

enter image description here

0 个答案:

没有答案