i Used the code below to save photos that taken from camera
code:
- (IBAction)saveImage:(id)sender {
UIImage *viewImage = imageView.image; // was taken from Camera
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
// Request to save the image to camera roll
[library writeImageToSavedPhotosAlbum:[viewImage CGImage] orientation:(ALAssetOrientation)[viewImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){
if (error) {
NSLog(@"error");
} else {
NSLog(@"url %@", assetURL);
self.imgUrl = assetURL;
}
}];
[library release];
}
this is the Log of NSLOG
assets-library://asset/asset.JPG?id=2A72A3FF-1662-4979-8DD7-0F5721C49F81&ext=JPG
Now when im done with the image how to remove it ?
I tried :
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:[self.imgUrl absoluteString] error:NULL];
but it didnt work
any help will be great
thank you in advance
If you don’t plan to save the image to the user’s Photo library permanently, why are you saving the image there initially ?
You should save the image to your application’s sandbox folder and then delete it from there.
You cannot delete images from the Photo Library