gpt4 book ai didi

ios - 线程 8 : Signal SIGABRT When performing a segue

转载 作者:行者123 更新时间:2023-11-30 12:17:11 29 4
gpt4 key购买 nike

当我保存视频时,会发生这种情况,我也试图连接到另一个 View Controller 。我不确定为什么应用程序在这里崩溃

func finalExportCompletion(_ session: AVAssetExportSession) {
PhotoManager().saveVideoToUserLibrary(fileUrl: session.outputURL!) { (success, error) in
if success {
ProgressHUD.showSuccess("Video Saved", interaction: true)
self.finalVideo = session.outputURL!
//FileManager.default.clearTmpDirectory()
self.clipsCollectionView.reloadData()
} else {
ProgressHUD.show(error?.localizedDescription)
}
self.performSegue(withIdentifier: "toPostVideoViewController", sender: nil)
}
}

最佳答案

当您处于后台线程时,您的崩溃是由于 UI 中的修改而导致的,正如您的崩溃日志所述,@rmaddy 在他的评论中,THREAD 8 是一个后台线程,您需要执行所有您的线程 1 中的 UI 操作是“主线程”,您必须像这样修改代码

func finalExportCompletion(_ session: AVAssetExportSession) {
PhotoManager().saveVideoToUserLibrary(fileUrl: session.outputURL!) { (success, error) in
DispatchQueue.main.async{
if success {
ProgressHUD.showSuccess("Video Saved", interaction: true)
self.finalVideo = session.outputURL!
//FileManager.default.clearTmpDirectory()
self.clipsCollectionView.reloadData()
} else {
ProgressHUD.show(error?.localizedDescription)
}
//I don't know if you anyway want to go to "toPostVideoViewController" this you need to do it also in main thread
self.performSegue(withIdentifier: "toPostVideoViewController", sender: nil)
}
}
}

关于ios - 线程 8 : Signal SIGABRT When performing a segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45262000/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com