Ios libc++;abi.dylib:以NSException类型的未捕获异常终止(AVAsset将视频和音频合并为一个视频)
我面临着一个非常奇怪的问题。我试图在触摸按钮时合并视频曲目和音频曲目。我第一次按下按钮时,它开始录制视频和音频(出于某些原因,我需要分别录制),第二次,它停止录制并创建指向视频和音频的两个URL 奇怪的事情来了。当我这样组合函数时:Ios libc++;abi.dylib:以NSException类型的未捕获异常终止(AVAsset将视频和音频合并为一个视频),ios,iphone,swift,xcode,swift4,Ios,Iphone,Swift,Xcode,Swift4,我面临着一个非常奇怪的问题。我试图在触摸按钮时合并视频曲目和音频曲目。我第一次按下按钮时,它开始录制视频和音频(出于某些原因,我需要分别录制),第二次,它停止录制并创建指向视频和音频的两个URL 奇怪的事情来了。当我这样组合函数时: @objc func touchCameraButton(){ if isVideoRecordingOn{ if isFirstTouch{ startCapture() recordAu
@objc func touchCameraButton(){
if isVideoRecordingOn{
if isFirstTouch{
startCapture()
recordAudio()
isFirstTouch = false
}else{
startCapture()
recordAudio()
self.mergeVideoAndAudio(videoUrl: videoFileURL, audioUrl: soundFileURL!, shouldFlipHorizontally: true, completion: {(err, url) in
self.videoWithAudioURL = url
if (err != nil){
print(err?.localizedDescription ?? "Error in merging video and audio")
}
self.isFirstTouch = true
})
}
}
}
它不工作,并引发NSException类型的未捕获异常
但是,如果我将merge函数单独放在另一个按钮中,整个程序工作正常。看起来是这样的:
@objc func touchCameraButton(){
if isVideoRecordingOn{
if isFirstTouch{
startCapture()
recordAudio()
isFirstTouch = false
}else{
startCapture()
recordAudio()
// startCapture()
// recordAudio()
// self.mergeVideoAndAudio(videoUrl: videoFileURL, audioUrl: soundFileURL!, shouldFlipHorizontally: true, completion: {(err, url) in
// self.videoWithAudioURL = url
// if (err != nil){
// print(err?.localizedDescription ?? "Error in merging video and audio")
// }
// self.isFirstTouch = true
// })
}
}
}
@IBAction func touchSomeButton(_ sender: Any) {
self.mergeVideoAndAudio(videoUrl: videoFileURL, audioUrl: soundFileURL!, shouldFlipHorizontally: true, completion: {(err, url) in
self.videoWithAudioURL = url
if (err != nil){
print(err?.localizedDescription ?? "Error in merging video and audio")
}
})
}
我已经陷入这个问题两天了,完全不知道发生了什么。我想这可能是后台线程和主线程的一些问题,我不知道 显示完整的错误消息。您应该在控制台中有用的错误消息的开头有“终止”(以大写字母开头)和“NSUncaughtException”(而不是NSException),直到您给出的那一行。@Larme这是什么意思?我对XCode比较陌生。。。