Closed
Description
[REQUIRED] Step 2: Describe your environment
- Xcode version: 10
- Firebase SDK version: Newest from Git
- Firebase Component: Storage (Auth, Core, Database, Firestore, Messaging, Storage, etc)
- Component version: Newest from branch master
[REQUIRED] Step 3: Describe the problem
I'm developing uploading screenshot to Storage for macOS application. I used these code below, it does not throw any error or crash. I don't see any new file on Storage after upload and callback at putFile
won't be called.
Steps to reproduce:
let storage = Storage.storage()
let localFile = URL(string: "/Users/truonghieu/Library/Containers/com.example.appname/Data/Documents/appname/image.jpg")
let storageRef = storage.reference().child("abc.jpg")
let uploadTask = storageRef.putFile(from: localFile!, metadata: nil) { metadata, error in
guard metadata != nil else{
print("error: \(String(describing: error?.localizedDescription))")
return
}
let fileManager = FileManager.default
if fileManager.fileExists(atPath: localPath) {
do {
try fileManager.removeItem(at: localFile!)
print("success: move item\(localPath)")
}catch{
print("failed: move item\(localPath)")
}
}
}