我只是从Firebase开始,我不确定是什么原因导致了我的问题。我已经完成了官方教程中所述的所有操作,但是每次我尝试执行功能downlFile时,我的应用程序突然崩溃。谁能告诉我这是什么问题?
{
var storage = FirebaseStorage.getInstance()
var storageRef = storage.reference
override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
fun downlFile(view: View?)
{
var spaceRef = storageRef.child("team.png")
val localFile = File.createTempFile("image", "png")
spaceRef.getFile(localFile).addOnSuccessListener {
//Local temp file has been created
}.addOnFailureListener {
// Handle any errors
}
}
}