Friday, January 12, 2024
HomeiOS Developmentios - Tips on how to add a picture and video to...

ios – Tips on how to add a picture and video to firebase


I’m making an attempt to add a picture and a video to firebase however they’re importing collectively I wish to add them individually so after I fetch my consumer submit from firebase they don’t show collectively like this the videoUrl is added to imageurl however I wish to add them individually .

How do I arrange my code to add my picture and videoUrl to firebase with out receiving any errors

I’ve tried utilizing completely different strategies however I bumped into some errors

Can’t convert worth of kind ‘PhotosPickerItem’ to anticipated argument kind ‘String’

var videoUrl: String? = nil

if let vidUrl = selectedImage{
    guard let url = URL(string: vidUrl) else { return }
    let videosUrl = attempt await VideoUploader.uploadVideoToStorage(withUrl: url)
}

And I additionally tried this methodology additionally and it gave me a error as nicely

Thread 1: Deadly error: Unexpectedly discovered nil whereas unwrapping an Elective worth

var videoUrl: String? = nil
   
if let url = URL(string: videoUrl!) {
    let videoUrl = attempt await VideoUploader.uploadVideoToStorage(withUrl: url)
}
class UploadViewModel: NSObject, ObservableObject {
    @Printed var error: Error?
    @Printed var movies = [Video]()
    @Printed var selectedVideoUrl: URL?
    @Printed var selectedImage: PhotosPickerItem? {
        didSet {
            
            Job { attempt await uploadVideo() }
        }
    }
    
    non-public var uiImage: UIImage?
    non-public var videoData: Information?
    func uploadPost() async throws {
        guard let uid = Auth.auth().currentUser?.uid else { return }
        
         var videoUrl: String? = nil
       
        if let url = URL(string: videoUrl!) {
            let videoUrl = attempt await VideoUploader.uploadVideoToStorage(withUrl: url)
        }



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments