I have created "photos album" from my App, using IOS AssetsLibrary.
Reading ALAssetsLibrary,ALAssetsGroup and ALAsset documentations, i have seen methods to "addAsset","addAssetsGroupAlbumWithName".
Is there a way to delete PROGRAMMATICALLY my ALAssetsGroup and ALAsset. (the property 'editable' suppose to be TRUE because i create this data).
You may delete any asset in the library using documented API ONLY.
over writing the [ALAsset isEditable] function:
like evanchin said, delete the asset:
This is not possible using any documented API. Only the photos app can delete Albums. If you want this feature to be added to iOS, I would fill a feature request at http://radar.apple.com.
evanchin is correct. Further more, if you want to do this in Xamarin.iOS (aka monotouch):
This code will delete all images that your app added to the ALAssetsLibrary.
As Ted said, this is now possible in iOS 8 using the Photos service. It's pretty clean actually. You need to submit a change request to the photolibrary. Here's an example.
Make sure you've imported Photos, and gotten authorization from the user. (Which you probably did to show the image already)
PHAssetchangeRequest - deleteAssets https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAssetChangeRequest_Class/index.html#//apple_ref/occ/clm/PHAssetChangeRequest/deleteAssets: PHPhotoLibrary Class - authorizationStatus https://developer.apple.com/library/ios/documentation/Photos/Reference/PHPhotoLibrary_Class/#//apple_ref/occ/clm/PHPhotoLibrary/authorizationStatus
in ios8 deleting photos might be possible using the Photos Framework
Please check the documentation of Photos Framework
For deleting assets refer to PHAssetChangeRequest
where
assets
is an array ofPHAsset
objects to be deleted.For deleting collections refer to PHAssetCollectionChangeRequest
https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAssetChangeRequest_Class/index.html#//apple_ref/occ/clm/PHAssetChangeRequest/deleteAssets:
You can only delete the ALAsset which is created by your app with document API [ALAsset setImageData:metadata:completionBlock:] (But I have not found any API to delete a ALAssetGroup).
1). Add an image "photo.jpg" to your project 2). Save an image to asset library:
3). Go to default gallery, you will find photo.jpg in your "Saved Photos" album.
4). Delete this image from asset library:
5). Go to default gallery, you will find photo.jpg has already been deleted.