gpt4 book ai didi

ios - 检查 child 会导致可扩展性差吗?

转载 作者:行者123 更新时间:2023-11-28 10:14:25 25 4
gpt4 key购买 nike

这不是一个必然有“解决方案”的问题,但我想知道这段代码在规模更大时是否会导致内存问题。

        ref.child("Teams").observeSingleEvent(of: .value, with: { (snapshot) in
if snapshot.hasChild(self.teamName.text!){
//Sets the a single team's values
} else {
//Displays a missing team alert
let alert = UIAlertController(title: "Error" , message: "Team does not exist", preferredStyle: .alert)
let actio1n = UIAlertAction(title: "Ok" , style: .cancel , handler: nil)
alert.addAction(actio1n)
self.present(alert, animated: true, completion: nil)
}
})

我有点想知道 Firebase 是否只会加载表面级别(每个团队的 ID),或者它是否会加载更深入的内容。你有什么想法?

最佳答案

Firebase 将获取 Teams 下的完整树。更多详情 here :

[...] when you fetch data at a location in your database, you also retrieve all of its child nodes [...]

关于ios - 检查 child 会导致可扩展性差吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43213048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com