Mitesh Dobareeya
Mitesh Dobareeya

Reputation: 1020

How to delete multiple images from photos app selected by ELCImagePickerController?

I use ELCImagePickerController for select multiple images from photos app in my application. I want to delete those images from photos app selected by ELCImagePickerController. Please help me to solve this.

ELCImagePickerController allowed two methods.

- (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info;
- (void)elcImagePickerControllerDidCancel:(ELCImagePickerController *)picker;

Upvotes: 0

Views: 347

Answers (1)

A. Petrizza
A. Petrizza

Reputation: 3350

You will need to use the PHPhotoLibrary.

Using PHAssetChangeRequest

For my project I used this, and it is in swift, but I hope this will give you the right idea. This works perfectly for me:

PHPhotoLibrary.sharedPhotoLibrary().performChanges({
      PHAssetChangeRequest.deleteAssets(photoAssets)
      }, completionHandler: { success, error in
      NSLog("Completed deletion of asset. %@", (success ? "Success" : error!)) 
})

You would want to implement this in didFinishPickingMediaWithInfo

Hopefully this helps.

Upvotes: 0

Related Questions