5

I have created an Application that fetches Images from the photo library of the phone and displays it on a collection view. Now, I want that whenever the user selects an image and click on a delete button that particular image gets deleted from the collection view as well as from the image library. I am using ALAssetLibrary to fetch the images. I searched a lot but did not find any way to delete the image from the photo library.

Can anybody tell me that how I can delete a photo from photo library programmatically from my application.

Mani
  • 17,549
  • 13
  • 79
  • 100
Santosh
  • 1,254
  • 2
  • 16
  • 31
  • I have already read that answer but its not working for me thats why I am asking this question. – Santosh Jan 31 '14 at 10:25
  • If you read the accepted answer (highest voted answer), it says this cannot be done. – Amar Jan 31 '14 at 10:27
  • I have tried and able to fetch a path but can not reach the exact directory where the file exist. Can you help me with this. – Santosh Jan 31 '14 at 10:28
  • @Sanny Please read my comment. Any 3rd party app cannot delete data from the `Photos.app` programmatically. It is **not possible**. – Amar Jan 31 '14 at 10:32
  • you can delete photos saved by your app. not the other photos – Sunny Shah Jan 31 '14 at 10:41

1 Answers1

4

You can copy files from the gallery into your application's file system sandbox, where you can do anything you want with them. However, your application can't modify files outside the sandbox. This includes files in the gallery.

As this answer says, there doesn't appear to be a method defined for deleting photos there.

Community
  • 1
  • 1
etolstoy
  • 1,798
  • 21
  • 33