我正在使用
UIImageWriteToSavedPhotosAlbum(image,nil,nil,nil);
保存图像,但我想知道它在哪里保存,意思是参考 URL 和保存图像的名称..
您可以使用 ALAssetsLibrary 获取它
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:myCGImage metadata:nil completionBlock:^(NSURL* assetURL, NSError* error)
{
if (error.code == 0) {
NSLog(@"URL %@", assetURL);
[library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
NSLog(@"Filename %@", [[asset defaultRepresentation] filename]);
}
failureBlock:^(NSError* error) {
NSLog(@"failed to retrieve image asset:\nError: %@ ", [error localizedDescription]);
}];
}else {
NSLog(@"saved image failed.\nerror code %i\n%@", error.code, [error localizedDescription]);
}
}];