2011-06-15 2 views
2

AVFoundation을 사용하여 captureStillImage 함수를 구현하고 있습니다. 이 같은 오류 던져카메라에서 앨범으로 이미지 캡처를 빠르게 저장하는 방법

if (imageDataSampleBuffer != NULL) { 

    NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; 
    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; 

    UIImage *image = [[UIImage alloc] initWithData:imageData]; 
    NSLog(@"capturestill image size is %@", NSStringFromCGSize(image.size)); 
    [library writeImageToSavedPhotosAlbum:[image CGImage] 
     orientation:(ALAssetOrientation)[image imageOrientation] 
     completionBlock:completionBlock]; 
    [image release]; 

    [library release]; 
} 

내가 아이폰에 앨범에 이미지를 작성하기 위해 다음과 코드를 사용

:

쓰기 없음을의 때문에이 자산을 작성하는 문제가 발생했습니다 쓰기 리소스가 사용 중입니다.

어디에서 문제가 발생할 수 있습니까?

+1

아래에서 답을 수정 했습니까? – Darren

답변

1

완료 블록에서 오류를 확인하고 ALAssetsLibraryWriteBusyError 인 경우 해당 애셋을 다시 저장해야합니다. 메서드가 디스크에 쓰기를 시도 할 때 디스크에 쓰려고하는 다른 것을 의미합니다.

관련 문제