我正在尝试将视频文件从ios应用上传到Firebase,但出现以下错误消息:
2020-07-01 10:46:22.734237 + 0100 AppName [17646:835206] [core]“从守护程序返回错误:错误Domain = com.apple.accounts代码= 7(空) 2020-07-01 10:46:28.031932 + 0100 AppName [17646:835206]任务<568D30E0-41B3-4ADC-BC14-0E85365B1BAC>。<1>完成,错误为[-1]错误域= NSURLErrorDomain代码= -1“未知错误” 不工作
func convertAssestsToImages() -> Void {
if selectedAssets.count != 0{
for i in 0..<selectedAssets.count{
let manger = PHImageManager.default()
let optionB = PHVideoRequestOptions()
let db = Firestore.firestore()
let pictureID = randomString(length: 12)
let video_name = "Video\(pictureID)"
let storageRef = Storage.storage().reference()
optionB.isNetworkAccessAllowed = true
manger.requestAVAsset(forVideo: selectedAssets[i], options: optionB) { (asset: AVAsset?, audioMix: AVAudioMix?, info: [AnyHashable : Any]?) -> Void in
if let urlAsset = asset as? AVURLAsset {
//***video upload***
let localVideoUrl: URL = urlAsset.url as URL
let storeVideo = storageRef.child("NAME1").child(SUB_NAME).child(video_name)
let metaData = StorageMetadata()
metaData.contentType = "image/jpg"
storeVideo.putFile(from: localVideoUrl, metadata: metaData) { (metaData, error) in
if error != nil {
print("NOT WORKING")
}else{
print("WORKING")
}
}
}
}
}
}
}