我将我的项目转换为 arc,现在,当我实例化一个新的资产库时,它会引发错误的访问错误。在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);
}
}];