ios - Firebase 有时会崩溃,但并非总是如此

标签 ios swift firebase firebase-realtime-database

当我检索数组时,我使用此函数:

self.gameRef!.observeSingleEvent(of: .value, with: { (snapshot) in
                    let value = snapshot.value as? NSDictionary
                    let seeds = value?["seed"] as! [Int]
}

这是我的错误:

enter image description here

这是我的结构:

enter image description here

但是,大多数时候它都在工作。有时,我会遇到这种崩溃。我不知道为什么。感谢您的帮助。

最佳答案

我会尝试解开快照值

self.gameRef!.observeSingleEvent(of: .value, with: { (snapshot) in

             if let value = snapshot.value as? [String:[Int]], let seeds = value["seed"]{
             //continue
}  
}

关于ios - Firebase 有时会崩溃,但并非总是如此,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42772030/

相关文章:

ios - 是否有任何工具可以跟踪 iOS 上特定文件的页面错误和其他相关事件?

ios - 不断检查变量变化

ios - UI 测试 - isSelected 总是返回 false

firebase - 架构armv7的 undefined symbol : "_OBJC_CLASS_$_FIRApp"

javascript - 从 firebase 函数返回

ios - 如何在 swift 2 的 UITableViewController 中自动调整表中的行高?

html - 将 HTML 拆分为页面,不将行切成两半

ios - iOS7 中UITextView contentSize 的变化和NSLayoutManager

ios - 使用 swift 捕获 NSMallocExceptioni

android - install_referrer Intent 弃用和更新库