Similar to this this question,
I am having issues and my app is crashing in the same way. I would assume the same answer as on the other question: memory issue; except I am getting the crash during an AVAssetExportSession call.
guard let exporter = AVAssetExportSession(asset: mixComposition, presetName: AVAssetExportPresetHighestQuality) else { return }
exporter.outputFileType = AVFileTypeMPEG4
exporter.outputURL = url
exporter.videoComposition = mainComposition
print("done")
exporter.exportAsynchronously(completionHandler: {
DispatchQueue.main.async(execute: {
self.exportDidFinish(exporter)
print("removing AI")
self.removeAI()
print("removed AI")
completion()
})
})
func exportDidFinish(_ exporter:AVAssetExportSession) {
if(exporter.status == AVAssetExportSessionStatus.completed) {
print("cool")
}
else if(exporter.status == AVAssetExportSessionStatus.failed) {
print(exporter.error as Any)
}
}
It prints "done" but it never prints "removing AI". It also doesn't print "cool" or "(error)"; it crashes and says at the top of XCode "Lost connection to iPhone..." just as the other question states.
I would assume it is a memory issue, but there is nothing happening in between (to my knowledge of how this works) during the asynchronous exporting as I am just waiting for the completion handler to be called. But nothing gets called in between and I am unsure how to handle this. Any thoughts?