ios - 带有 AVCaptureVideoDataOutput 的 iOS 应用程序在 App Store 版本中崩溃
问题描述
我有一个使用相机的应用程序。在上一个版本中,我将相机控件移到了一个新类中,它在 App Store 版本中开始崩溃,除了第一次运行。通过 Xcode 安装时,该应用程序按预期工作。
我有以下功能来进行配置。
func performConfiguration(block: @escaping (() -> Void)) {
sessionQueue.async { () -> Void in
block()
}
}
应用程序在我检查是否可以将视频输出添加到会话的行中崩溃(下面的第 6 行):
func configureVideoOutput() {
performConfiguration { () -> Void in
self.videoOutput = AVCaptureVideoDataOutput()
self.videoOutput.setSampleBufferDelegate(self.delegate_voutput, queue: DispatchQueue(label: "sample buffer delegate"))
if self.session.canAddOutput(self.videoOutput) {
self.session.addOutput(self.videoOutput)
let connection = self.videoOutput.connection(with: .video)
connection?.videoOrientation = .portrait
}
}
}
这是 delegate_voutput 代码:
weak var delegate_voutput: AVCaptureVideoDataOutputSampleBufferDelegate?
我将视图控制器中的 delegate_voutput 设置为“self”并实现委托功能。
这是来自 App Store 的崩溃日志:
0 MyApp 0x1003b921c closure #1 in CameraController.configureVideoOutput()
1 MyApp 0x1003b9e90 partial apply for closure #1 in CameraController.performConfiguration(block:)
2 MyApp 0x1003bd2c8 thunk for @escaping @callee_guaranteed () -> ()
3 libdispatch.dylib 0x192ff8304 _dispatch_call_block_and_release
我已经添加NSCameraUsageDescription
到 info.plist 以及本地化版本(InfoPlist.strings),以防这是原因..
我不确定第一次启动时具体是什么,因为硬盘驱动器中没有存储与配置相关的任何内容。
有没有办法在不提交应用程序进行审核的情况下测试 App Store 行为?TestFlight 会给出相同的行为吗?
编辑:这是sessionQueue
在中声明的方式CameraController.swift
:
private var sessionQueue = DispatchQueue(label: "com.mikrasya.myapp")
解决方案
我按照解决崩溃的 Apple AVCam 示例代码更改了应用程序的架构。
为什么 App 在使用 Xcode 安装时可以正常但在 App Store 版本中崩溃仍然是个谜。
推荐阅读
- sql - sql server 等效于 xmlelement 格式
- python - Django 正在改变我的整数列表的顺序
- vba - 将数据保存在一个文件中并在每次保存时将输出转到另一个文件
- jmh - jmh 结果中的 cnt 列是什么?
- unity3d - 无法在世界空间中获取鼠标位置
- c - 为 C 代码创建单元测试时出现 LNK2001 问题
- azure-active-directory - 在 Microsoft Graph API 中获取个人资料图片一无所获
- google-sheets - 我有值范围,我想计算 10% 的值有多少大于 13.5
- java - Java - Reader 流中的动态字符串替换
- ios - EKEvent eventIdentifier null xcode 9.4