Does anyone know how to delete the last photo in the mobile phone album without calling the photo album or camera?
业精于勤,荒于嬉;行成于思,毁于随。
Use Photos frames.
Get the assets collection first: [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:],option 给一个按时间倒序排序的PHFetchOptions,这样得到的集合的第一个就是最后一张。然后调用 PHPhotoLibrary.sharedPhotoLibrary performChanges..., 在block里执行 [PHAssetChangeRequest deleteAssets:]
[PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:]
PHPhotoLibrary.sharedPhotoLibrary performChanges...
[PHAssetChangeRequest deleteAssets:]
That’s the idea, just write the code yourself. There are official examples of Photos Framework.
Use Photos frames.
Get the assets collection first:
[PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:]
,option 给一个按时间倒序排序的PHFetchOptions,这样得到的集合的第一个就是最后一张。然后调用PHPhotoLibrary.sharedPhotoLibrary performChanges...
, 在block里执行[PHAssetChangeRequest deleteAssets:]
That’s the idea, just write the code yourself. There are official examples of Photos Framework.