简体   繁体   English

从实时数据库中获取图像 URL - Firebase / Swift

[英]Fetching Image Url's From Realtime Database - Firebase / Swift

Major edits required in the code - it did not make sense as I am a first time coder.代码中需要进行重大编辑 - 因为我是第一次编码,所以这没有意义。 When I update my code and when it will work, I will update the question.当我更新我的代码以及它何时可以工作时,我会更新问题。 For now it is closed.目前它已关闭。

Replace代替

    let snapshotValue = snapshot.value as? NSDictionary
    
    if let imageUrl = snapshotValue?[""] as? String {
        
        url = imageUrl
                   
    } else {
        
        url = ""
        
    }

with

 url = snapshot.value as! String 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM