Estoy intentando guardar un UIImage en el álbum de fotos. He intentado métodos severl el último es:Guardar UIImage al álbum de fotos con writeImageToSavedPhotosAlbum
-(IBAction)captureLocalImage:(id)sender{
[photoCaptureButton setEnabled:NO];
// Save to assets library
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum: imageView.image.CGImage metadata:nil completionBlock:^(NSURL *assetURL, NSError *error2)
{
// report_memory(@"After writing to library");
if (error2) {
NSLog(@"ERROR: the image failed to be written");
}
else {
NSLog(@"PHOTO SAVED - assetURL: %@", assetURL);
}
runOnMainQueueWithoutDeadlocking(^{
// report_memory(@"Operation completed");
[photoCaptureButton setEnabled:YES];
});
}];
}
imageView es un UIImageView que contienen la imagen que desea guardar. En el registro obtuve "PHOTO SAVED - assetURL: (null)" y la foto no se guarda en la biblioteca.
¿Qué estoy haciendo mal?
Estoy teniendo el mismo problema. Todavía no he resuelto la solución. – drhr
Eche un vistazo a mi respuesta a continuación. Resolví el mío, tal vez eso también te ayudaría. – Idan