如何在firebase中创建一个新子节点

时间:2017-04-08 13:11:15

标签: ios swift firebase firebase-realtime-database

我正在尝试使用以下代码在firebase中为我的节点创建一个新子节点:

FIRDatabase.database().reference().child((FIRAuth.auth()?.currentUser?.uid)!).child("following").setValue([ViewController.usersUid[currentUser]:"true"])
FIRDatabase.database().reference().child(ViewController.usersUid[currentUser]).child("followers").setValue([(FIRAuth.auth()?.currentUser?.uid)! : "true"])

每个孩子在我的数据库中正确创建,但我有一个错误:

在这个字符串上:

FIRDatabase.database().reference().child((FIRAuth.auth()?.currentUser?.uid)!).child("following").setValue([ViewController.usersUid[currentUser]:"true"])

我不知道这个错误是什么意思(控制台什么也没说)以及我如何解决它。请帮我处理。提前谢谢。

  
      
  • 线程#1:tid = 0x20d86,0x0000000100de1c78 libdispatch.dylib dispatch_group_leave + 76, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x100de1c78) * frame #0: 0x0000000100de1c78 libdispatch.dylib dispatch_group_leave + 76   第1帧:0x0000000100027498精英俱乐部thunk + 68 at ViewController.swift:0 frame #2: 0x00000001001438a4 Elite Club 43- [FValueEventRegistration   fireEvent:queue:] _ block_invoke.57((null)=)+ 88 at   FValueEventRegistration.m:60 [opt]   第3帧:0x0000000100ddd258 libdispatch.dylib _dispatch_call_block_and_release + 24 frame #4: 0x0000000100ddd218 libdispatch.dylib _ dispatch_client_callout + 16   第5帧:0x0000000100de2280 libdispatch.dylib _dispatch_main_queue_callback_4CF + 1200 frame #6: 0x0000000184386810 CoreFoundation __ CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12   帧#7:0x00000001843843fc CoreFoundation __CFRunLoopRun + 1660 frame #8: 0x00000001842b22b8 CoreFoundation CFRunLoopRunSpecific + 444   帧#9:0x0000000185d66198 GraphicsServices GSEventRunModal + 180 frame #10: 0x000000018a2f97fc UIKit - [UIApplication _run] + 684   帧#11:0x000000018a2f4534 UIKit UIApplicationMain + 208 frame #12: 0x0000000100044258 Elite Club main + 140 at AppDelegate.swift:15   帧#13:0x00000001832955b8 libdyld.dylib`start + 4
  •   

更新:我的回答中的解决方案:dispatch_group_leave error while adding new child

0 个答案:

没有答案