2
我正在使用AVFoundation實現captureStillImage功能。如何快速將圖像從攝像機保存到相冊
當我使用如下代碼到圖像寫在iPhone上張專輯,
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];
}
它拋出這樣的錯誤:
寫入繁忙, 有寫這個資產,因爲一個問題寫資源很忙。
任何人都可以指出問題出在哪裏?
你下面的答案解決了你的問題嗎? – Darren 2016-01-31 15:09:40