Memory crash with uploading image to Firebase Storage Swift
You need to resize your image to a lower size. We all know that photos captured by ios devices is quite large and sending it as data to a server is also a big workload. You can resize the image to your liking without losing most of its quality.
Check this out for resizing.
https://stackoverflow.com/a/31314494/11138557
Hope this helps: Thanks :)
Swift app crashes when uploading image to firebase
It looks like you forgot to use the child storage node you just created. As such, try replacing this code:
thumbnailStorageRef.child("thumbnails/" + randomString(length: 20) + ".png")
thumbnailStorageRef.put(imageData, metadata: nil, completion: ...
with this instead:
let imageRef = thumbnailStorageRef.child("thumbnails/" + randomString(length: 20) + ".png")
imageRef.put(imageData, metadata: nil, completion: ...
This change should fix your current issue ;)
Image not uploading to Firebase Storage
Since I forgot I had a @State var avatarImage = UIImage(systemName: "person.fill")!
inside a struct of type View, it was taking the picture the user selected and doing nothing, because the code was taking another @State var
as the picture with the info, to upload to Firebase (debugger showed self.image
was throwing nil).
Related Topics
Why I Can Not Use Equatable Function in My View When the View Can Use It in Swiftui
How to Combine Two Nsdictionary in Swift
Error: Extraneous Argument Label 'No1:' in Call
Generics and Functional Programming in Swift
Swift 5 Coredata Predicate Using Uuid
How to Pass Binding to Child View in the New Navigationstack.Navigationdestination
Swiftui Pass Two Child Views to View
Split String by Components and Keep Components in Place
Tapping an Mkmapview in Swiftui
Why Mark Something Final in Swift Except for Architectural Considerations
Swift Spritekit I Detect a Collison But It Reads the Collision Mulitple Times
Swift 3 Issue with Cvararg Being Passed Multiple Times
Trouble with Non-Escaping Closures in Swift 3
Swift 2.2, Contains Method Not Working