Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android .Firebase读取kotlin中的数据_Android_Firebase_Kotlin_Google Cloud Firestore - Fatal编程技术网

Android .Firebase读取kotlin中的数据

Android .Firebase读取kotlin中的数据,android,firebase,kotlin,google-cloud-firestore,Android,Firebase,Kotlin,Google Cloud Firestore,嗨,当我尝试在文档引用中获取数据时,它给我的For循环范围在使用in For循环时必须有“iterator()”方法错误。我想这看起来像是一张快照!。 我知道它应该是可变列表。但我对此不确定 fun firebase_read() { if (mAuth.currentUser != null) { val schedule_document = databsae.collection("schedules").document(mAuth.c

嗨,当我尝试在文档引用中获取数据时,它给我的For循环范围在使用in For循环时必须有“iterator()”方法错误。我想这看起来像是一张快照!。 我知道它应该是可变列表。但我对此不确定

    fun firebase_read() {
    if (mAuth.currentUser != null) {
        val schedule_document = databsae.collection("schedules").document(mAuth.currentUser!!.phoneNumber.toString())
        schedule_document.get().addOnSuccessListener { document ->
            if (document != null) {
                for (i in document) {
                    }
                }
            }
        }
    }
}

文档
将成为一个对象。它不适合使用for循环

如果试图迭代文档中的字段,可以调用并迭代返回的映射,就像在Kotlin中迭代任何其他映射一样