objc_exception_throw AVCapturePhotoOutput capturePhotoWithSettings 方法异常
objc_exception_throw exception with AVCapturePhotoOutput capturePhotoWithSettings Method
我在 Apple 审批流程中遇到异常,但不确定原因。我无法在本地 iPad.
重复
现在,在我的 xcode IDE 9.3 中,对于 swift 文件,photoOutput 是唯一出现的文件。当苹果测试批准时,他们一直向我显示以下错误:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
调用轨迹为:
0 CoreFoundation 0x1834d2d8c __exceptionPreprocess + 228
1 libobjc.A.dylib 0x18268c5ec objc_exception_throw + 55
2 AVFoundation 0x18905adc4 -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] + 811
3 MyApp 0x10082fa1c closure #1 in SnapViewController.snapAction(_:) + 64028 (SnapViewController.swift:0)
4 MyApp 0x10083f6ac _T0Ieg_IeyB_TR + 128684 (BasicPopoverTableViewController.swift:0)
这是我的代码 -
DispatchQueue.main.async {
let photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.jpeg,
AVVideoCompressionPropertiesKey: [AVVideoQualityKey : NSNumber(value: COMPRESSION_QUALITY)]])
photoSettings.isAutoStillImageStabilizationEnabled = true
photoSettings.isHighResolutionPhotoEnabled = true
photoSettings.flashMode = .auto
self.capturePhotoOutput!.capturePhoto(with: photoSettings, delegate: self)
}
extension SnapViewController : AVCapturePhotoCaptureDelegate {
func photoOutput(_ output: AVCapturePhotoOutput,
didFinishProcessingPhoto photo: AVCapturePhoto,
error: Error?) {
......
}
}
我不确定 objc_exception_throw 是如何跳出来的,在我对 11.3 的本地测试中,我从未见过。我能做些什么来找出原因?
此外,非常有趣的是,BasicPopoverTableViewController.swift 不应在此阶段使用。这用于某些永远不应与 SnapViewController.snapAction(_:)
关联的 Popover 代码。我有点担心符号化过程。
谢谢!
和@Spads说的一样,错误是AVCapturePhotoSettings的内容引起的。在设置选项之前我没有查询设备容量,这造成了混乱的 none- 信息错误。我进行了以下更改,Apple 现在接受了该应用程序。
if (self.captureDevice!.isFlashAvailable){
photoSettings.flashMode = .auto
}
else {
photoSettings.flashMode = .off
}
if self.capturePhotoOutput!.isStillImageStabilizationSupported {
photoSettings.isAutoStillImageStabilizationEnabled = true
}
photoSettings.isHighResolutionPhotoEnabled = true
我在 Apple 审批流程中遇到异常,但不确定原因。我无法在本地 iPad.
重复现在,在我的 xcode IDE 9.3 中,对于 swift 文件,photoOutput 是唯一出现的文件。当苹果测试批准时,他们一直向我显示以下错误:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
调用轨迹为:
0 CoreFoundation 0x1834d2d8c __exceptionPreprocess + 228
1 libobjc.A.dylib 0x18268c5ec objc_exception_throw + 55
2 AVFoundation 0x18905adc4 -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] + 811
3 MyApp 0x10082fa1c closure #1 in SnapViewController.snapAction(_:) + 64028 (SnapViewController.swift:0)
4 MyApp 0x10083f6ac _T0Ieg_IeyB_TR + 128684 (BasicPopoverTableViewController.swift:0)
这是我的代码 -
DispatchQueue.main.async {
let photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.jpeg,
AVVideoCompressionPropertiesKey: [AVVideoQualityKey : NSNumber(value: COMPRESSION_QUALITY)]])
photoSettings.isAutoStillImageStabilizationEnabled = true
photoSettings.isHighResolutionPhotoEnabled = true
photoSettings.flashMode = .auto
self.capturePhotoOutput!.capturePhoto(with: photoSettings, delegate: self)
}
extension SnapViewController : AVCapturePhotoCaptureDelegate {
func photoOutput(_ output: AVCapturePhotoOutput,
didFinishProcessingPhoto photo: AVCapturePhoto,
error: Error?) {
......
}
}
我不确定 objc_exception_throw 是如何跳出来的,在我对 11.3 的本地测试中,我从未见过。我能做些什么来找出原因?
此外,非常有趣的是,BasicPopoverTableViewController.swift 不应在此阶段使用。这用于某些永远不应与 SnapViewController.snapAction(_:)
关联的 Popover 代码。我有点担心符号化过程。
谢谢!
和@Spads说的一样,错误是AVCapturePhotoSettings的内容引起的。在设置选项之前我没有查询设备容量,这造成了混乱的 none- 信息错误。我进行了以下更改,Apple 现在接受了该应用程序。
if (self.captureDevice!.isFlashAvailable){
photoSettings.flashMode = .auto
}
else {
photoSettings.flashMode = .off
}
if self.capturePhotoOutput!.isStillImageStabilizationSupported {
photoSettings.isAutoStillImageStabilizationEnabled = true
}
photoSettings.isHighResolutionPhotoEnabled = true