プロジェクトをアークに変換しましたが、新しいアセットライブラリをインスタンス化すると、アクセス不良エラーがスローされます。ARC以前は問題ありませんでした。
助言がありますか?
[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:stillImageConnection
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error)
{
if (error) {
NSLog(@"Take picture failed");
}
else
{
NSData *jpegData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
CFDictionaryRef attachments = CMCopyDictionaryOfAttachments(kCFAllocatorDefault,
imageDataSampleBuffer,
kCMAttachmentMode_ShouldPropagate);
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageDataToSavedPhotosAlbum:jpegData
metadata:(__bridge_transfer id)attachments
completionBlock:^(NSURL *assetURL, NSError *error) {
if (error) {
NSLog(@"Save to camera roll failed");
}
}];
if (attachments)
CFRelease(attachments);
}
}];