Closed KunalxBhandari closed 3 months ago
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 https://github.com/firebase/firebase-ios-sdk/pull/10492 and I'm not sure why that would matter.
I'm not sure how the task could be deallocated between the StorageDownloadTask
init and the task.enqueue()
call.
Does adding a wait or sleep to the bottom of downloadFileFromFirebase
make a difference?
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.
Hello, I'm facing a similar issue, where the downloadProgressBlock
never gets called
line 134
never gets executed.
Any idea what could cause this ?
nor the fetcherCompletion
Does the app finish before the write
completes?
Hey @KunalxBhandari. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
I used the Thread.sleep(0.1) before my function body ends and now code is working fine. But like I explained, I was not getting the callback because the firebase object was deallocating. I don't know why that was happening but for now thread sleep seems to have worked for me.
is there any update here ?
I'm still not able to reproduce. When I add the code above into an app, I see the breakpoint in enqueueImplementation
hit before the deallocation.
Would you share a fully reproducible example?
I would love to but unfortunately I can't.
Hey @KunalxBhandari. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@KunalxBhandari if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
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
snippet```json Replace this line with the contents of your Package.resolved. ```
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippet```yml Replace this line with the contents of your Podfile.lock! ```