编译错误是void function swift中的意外非void返回值。
static func getPhoto(byURL url: String) -> UIImage {
let photoPrefix = "gs://chatwithroyal-6c9ee.appspot.com/"
let photoType = ".png"
let photoURL = photoPrefix + url + photoType
let image = UIImage()
FIRStorage.storage().reference(forURL: photoURL).data(withMaxSize: INT64_MAX, completion: { (data, error) in
if let error = error {
print("Error downloading: '\(error)")
return
}
let image = UIImage.init(data: data!)
return image
})
}
任何想法都会非常感激!谢谢!