1

Firebase Storage から画像をダウンロードするときはいつでも完全にダウンロードされますが、imageview を「my」に変更しようとすると、imageview が消えます。制約はなく、ローカル URL に移動したところ、画像が完全に見つかりました。何か助けはありますか?私は何か間違ったことをしていますか?

func loadImages(){
        let documentDirectoryURL = try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: true)

            let newRef = storageRef!.child("Images/0.jpg")
            let fileDestinationUrl = documentDirectoryURL.URLByAppendingPathComponent("p.jpg")


            let downloadTask = newRef.writeToFile(fileDestinationUrl){ (URL, error) -> Void in
                if (error != nil) {
                    print("problem")
                } else {
                    print("done")
                }
            }

        downloadTask.observeStatus(.Success) { (snapshot) -> Void in
            print(fileDestinationUrl)
            var temp = String(fileDestinationUrl)
            print(temp)
            var my = UIImage(contentsOfFile: temp)
            self.image.image = my
        }


       }
4

1 に答える 1