Reputation: 663
I am trying to upload a video to Firebase Storage but I am getting the following error...
*** Assertion failure in -[FIRStorageUploadTask enqueue], /Users/.../Documents/.../.../Pods/FirebaseStorage/Firebase/Storage/FIRStorageUploadTask.m:73
I am able to upload images to Storage perfectly fine, and I am able to save the video to the phones camera roll perfectly.
Here is my code...
compressVideoWithOverlay(inputURL: videoURL, quality: AVAssetExportPreset640x480) { (exportSession) in
guard let storyVideoUrl = exportSession?.outputURL else { return }
let videoName = NSUUID().uuidString
guard let uid = Auth.auth().currentUser?.uid else { return }
let storageRef = Storage.storage().reference().child(uid).child("stories").child("\(videoName).mp4")
storageRef.putFile(from: storyVideoUrl, metadata: nil, completion: { (metadata, error) in
if error != nil {
print(error!)
self.stopActivityIndicatorWithMessage(completionMessage: R.string.stories.loadingMessageError())
self.hideToolbar(hide: false)
return
}...
The error is returned on
storageRef.putFile(from: storyVideoUrl, metadata: nil, completion: { (metadata, error) in
I have also tried putData and get the same error.
compressVideoWithOverlay() returns a fileURL which seems to be working fine as I use that same URL to save to the camera roll.
Any ideas on why this is happening?
Thanks
Upvotes: 0
Views: 626
Reputation: 663
Figured it out, for anyone else that runs into this - it's because I wasn't on the Main thread.
Upvotes: 3