小编pro*_*off的帖子

AVCaptureSession addInput:不适用于iOS7

我有一个应用程序可以正常使用以前的iOS版本,但后来我尝试在iOS7的设备上运行它,应用程序崩溃零星.我尝试使用Apple iOS7 GM SDK推荐的Xcode 5进行构建,以升级现有的应用程序,但问题没有解决.我试图研究Apple文档,但也没有找到任何东西AVCaptureSession

我的代码简单而标准

-(void)addVideoInput { 
    AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    if (videoDevice) {
        NSError *error;
        self.videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:&error];
        if ([self.captureSession canAddInput:self.videoInput]) {
            [self.captureSession addInput:self.videoInput];
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

应用程序在我的函数中与下一个Stacktrace崩溃:

0 libobjc.A.dylib 0x395adb26 objc_msgSend + 5
1 AVFoundation 0x2e33a991 <redacted> + 348
2 AVFoundation 0x2e33aca1 <redacted> + 112
3 AVFoundation 0x2e33c4d1 <redacted> + 316
4 AVFoundation 0x2e33560f <redacted> + 354
5 AVFoundation 0x2e339bf1 <redacted> + 1436
6 Foundation 0x2fdbed31 <redacted> + 272 …
Run Code Online (Sandbox Code Playgroud)

ios avcapturesession ios7

6
推荐指数
1
解决办法
2761
查看次数

标签 统计

avcapturesession ×1

ios ×1

ios7 ×1