无法从Firebase存储中快速检索图像4

时间:2019-02-27 12:15:33

标签: ios swift firebase-realtime-database firebase-storage

在获取我的错误时

Task <BA25D5D9-E054-4D9D-BB65-2770CFDBEED0>.<2> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://firebasestorage.googleapis.com/v0/b/relationships-at-peace.appspot.com/o/images_profile%2FProfile_Image_Of:VgMpm1a3ZaU8kQNXnMhXhhVecdF2?alt=media, NSErrorFailingURLKey=https://firebasestorage.googleapis.com/v0/b/relationships-at-peace.appspot.com/o/images_profile%2FProfile_Image_Of:VgMpm1a3ZaU8kQNXnMhXhhVecdF2?alt=media, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <BA25D5D9-E054-4D9D-BB65-2770CFDBEED0>.<2>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <BA25D5D9-E054-4D9D-BB65-2770CFDBEED0>.<2>, NSLocalizedDescription=cancelled} [-999]

我不知道为什么会收到此错误:

这是我用来获取图像的代码段:

func retreiveImagesFromFireBase(downloadUrl:String,imageHolder:UIImageView){
        if downloadUrl != ""{
            let storageRef = Storage.storage().reference(forURL: downloadUrl)
            // Download the data, assuming a max size of 1MB (you can change this as necessary)
            storageRef.getData(maxSize: 5*1024*1024) { (data, error) in
                if data != nil{
                    if let pic = UIImage(data: data!){
                        imageHolder.image = pic
                    }
                }
            }
        }
    }

0 个答案:

没有答案