New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firebase Storage Upload/Download Failures #12812
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Sorry about the trouble @KunalxBhandari. I'm not able to reproduce. The only possible impacting change since 10.2.0 I see is #10492 and I'm not sure why that would matter. I'm not sure how the task could be deallocated between the Does adding a wait or sleep to the bottom of Are you able to share a sample app that reproduces the issue? |
@paulb777 I'm using putData, delete, putFile, getMetadata, downloadURL functions of Storage and all of these are working fine expect the write function which I'm using for downloading the file from firebase storage. But on using sleep it's working fine. Is there any particular reason why this function is behaving like this? |
It's possible the write to FirebaseStorage is succeeding, but the UI doesn't update because the function finishes first. |
Description
I'm using firebase storage in order to upload some files and download those files later. I'm using the code down below in order to download the files from firebase storage.
func downloadFileFromFirebase(fireBasePath: String, localURL: String) {
let fireBaseStorage = Storage.storage().reference()
let storeRef = fireBaseStorage.child("(String(describing: fireBasePath))")
let downloadTask = storeRef.write(toFile: localURL)
downloadTask.observe(.progress) { snapshot in
// Updating the progress bar
}
downloadTask.observe(.success) { snapshot in
//Updating the UI
}
}
Here, what I noticed is that my downloadTask.observe closures are not invoking and I did some digging in the framework and found out that my task is never enqueued and the StorageDownloadTask is deallocated before that.
Line 110 is never executed.
Here in StorageReference on Line 204 we are creating a strong reference cycle with StorageDownloadTask but still it is deallocating before the enqueue implementation I don't know why. So, in order to confirm that issue is happening due to this deallocation reason, I deliberately created a retain cycle in StorageReference and made sure that the StorageDownloadTask is not deallocated.
And after creating this retain cycle my downloadTask.observe closures are invoking and I'm able to download the media from firebase storage. But this is not a solution to the problem as it will create retain cycle. Can somebody help with this problem and tell me why this is happening?
This problem started coming after 10.2.0 versions. Currently, I'm using the 10.24.0 version.
Reproducing the issue
No response
Firebase SDK Version
10.24.0
Xcode Version
15.3
Installation Method
CocoaPods
Firebase Product(s)
Storage
Targeted Platforms
iOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippetReplace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippetReplace this line with the contents of your Podfile.lock!
The text was updated successfully, but these errors were encountered: