无法将类型“ NSTaggedPointerString”的值强制转换为“ NSDictionary”

时间:2018-11-21 16:39:21

标签: swift firebase firebase-realtime-database

启动我的应用程序时,出现红色错误:线程1:信号SIGABRT ,并且在分析中说:无法将类型'NSTaggedPointerString'(0x10dc70598)的值强制转换为'NSDictionary'( 0x10dc708b8)。 代码:

func fetchDataFromServer(callback: @escaping (Room) -> ()) {
    DataService.dataService.ROOM_REF.observe(.childAdded) { (snapshot) in

        print("FOUND ROOM "+snapshot.key)

        let room = Room(key: snapshot.key, snapshot: snapshot.value as! Dictionary<String, AnyObject>)
        callback(room)
    }

一些JSON:

{
  "rooms" : {
    "-LRjiSQjXY4OkfQLRpCZ" : {
      "caption" : "Potatis",
      "thumbnailUrlFromStorage" : "gs://ilapp-   a1429.appspot.com/KLabp9zlfgZZ78dPQ9Eysrc9C6r2/564386764"
},

0 个答案:

没有答案