我在Apple批准过程中遇到了例外,但不确定原因。我无法在我当地的iPad上重复它。
现在,在我的xcode IDE 9.3中,对于swift文件,photoOutput是唯一显示的文件。经Apple测试批准后,他们不断向我显示以下错误:
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代码。我对sybolicating过程有点担心。
谢谢!
答案 0 :(得分:0)
与@Spads类似,错误是由AVCapturePhotoSettings的内容引起的。在设置选项之前我没有查询设备容量,并且创建了凌乱的无信息错误。我做了以下更改,Apple现在接受了该应用程序。
if (self.captureDevice!.isFlashAvailable){
photoSettings.flashMode = .auto
}
else {
photoSettings.flashMode = .off
}
if self.capturePhotoOutput!.isStillImageStabilizationSupported {
photoSettings.isAutoStillImageStabilizationEnabled = true
}
photoSettings.isHighResolutionPhotoEnabled = true