Ios AVCaptureVideoPreviewLayer崩溃应用程序发布
我对AVCaptureVideoPreviewLayer有问题。我是这样创建的:Ios AVCaptureVideoPreviewLayer崩溃应用程序发布,ios,avfoundation,Ios,Avfoundation,我对AVCaptureVideoPreviewLayer有问题。我是这样创建的: self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:session]; 会话是我的AVCaptureSession对象。其已初始化。当我从视图控制器弹出时,我的应用程序崩溃。我甚至不用这个梵蒂冈,反正我也会崩溃。我得到了EXC\u BAD\u访问代码=1;。self.previewLayer是我的类对象。我声明它在我的类中,然后用ret
self.previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:session];
会话是我的AVCaptureSession对象。其已初始化。当我从视图控制器弹出时,我的应用程序崩溃。我甚至不用这个梵蒂冈,反正我也会崩溃。我得到了EXC\u BAD\u访问代码=1;。self.previewLayer是我的类对象。我声明它在我的类中,然后用retain和nonatomic以及@synthesis使它成为属性。我使用的代码来自,唯一的区别是我使用的是AVCaptureVideoPreviewLayer。似乎我在释放这个对象时遇到了问题。谁能告诉我我做错了什么
编辑
我终于解决了。我没有注销videoOut代理:)
PS:我使用自动引用计数您能否提供更多有关如何访问AVCaptureVideoPreviewLayer的详细信息。如果有,请粘贴崩溃日志 请使用下面的代码块进行代码模拟
if ([self captureManager] == nil) {
captureManager = [[AVCamCaptureManager alloc] init];
captureManager.delegate = self;
if ([[self captureManager] setupSession] && _captureVideoPreviewLayer == nil) {
// Create video preview layer and add it to the UI
_captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:[[self captureManager] session]];
if ([_captureVideoPreviewLayer isOrientationSupported]) {
[_captureVideoPreviewLayer setOrientation:AVCaptureVideoOrientationPortrait];
}
[_captureVideoPreviewLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
// Start the session. This is done asychronously since -startRunning doesn't return until the session is running.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[[self captureManager] session] startRunning];
});
}
}
希望能有帮助。请检查并让我知道是否必须使用其他解决方案。崩溃线程的堆栈是什么样子的?它是这样的:如果将线程视图底部的滑块一直向右移动,它将显示堆栈中的所有帧。那会更有帮助。然而,由于顶部框架是obj_msgSend,我建议在构建方案中启用僵尸并运行它。它可能会在调试控制台中为您提供更有用的消息。