AVCamDemo:未单击完成处理程序代码

| 我正在简化“ 0”项目,以便可以尝试仅捕获静止图像。 以下是
captureStillImage()
方法的新代码:
- (void) captureStillImage
{
    AVCaptureConnection *stillImageConnection = [AVCamUtilities connectionWithMediaType:AVMediaTypeVideo fromConnections:[[self stillImageOutput] connections]];
    if ([stillImageConnection isVideoOrientationSupported]) {
        [stillImageConnection setVideoOrientation:orientation];
    }
    [[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:stillImageConnection
                completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
NSLog(@\"In the completionHandler block\");
           if (imageDataSampleBuffer != NULL) {
               NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
               UIImage *image = [[UIImage alloc] initWithData:imageData];
                     [self writeImageFile:image];
                     [image release];
            }
          if ([[self delegate] respondsToSelector:@selector(captureManagerStillImageCaptured:)]) {
               [[self delegate] captureManagerStillImageCaptured:self];
                }
     }];
NSLog(@\"exiting....\");
}
在我的测试中,我发现有时块中的NSLog语句未执行....因此,stillImage文件未保存。 我是否遇到时间问题?如果是这样,我该如何解决? 谢谢并恭祝安康。 山姆     
已邀请:

要回复问题请先登录注册