应用程序不断崩溃,但没有任何泄漏。使用AVFoundation

时间:2016-05-08 20:17:41

标签: ios objective-c xcode crash avfoundation

我的应用程序在ViewControllers之间来回移动后不断崩溃。 我检查了泄漏,一切都很好。当我检查分配时,我看到每次拍摄时会弹出15megs的数据(这是图片),然后我转到我的下一个ViewController,然后返回到CameraViewController并拍摄另一张照片,15megs变为30 megs等等直到它崩溃。

它似乎是拍照方法,这就是它的样子,

 AVCaptureConnection *videoConnection = [self.stillImageOutput connectionWithMediaType:AVMediaTypeVideo];

if (videoConnection == nil) {
    NSLog (@"no connection");
    return;
}

[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection
 completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {

if (imageDataSampleBuffer == NULL) {
         return;
}

NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
     UIImage *image = [[UIImage alloc] initWithData:imageData];
     self.imageFromCamController = image;  

[self performSegueWithIdentifier:@"share" sender:self]; 
}];

所以我尝试在传递数据之后设置将图像存储为nil的属性,但是没有做任何事情。

我怀疑这是CMSampleBufferRef imageDataSampleBuffer,但我很遗憾该怎么办。

0 个答案:

没有答案