search

Home  >  Q&A  >  body text

iOS photo album delete last photo - Stack Overflow

Does anyone know how to delete the last photo in the mobile phone album without calling the photo album or camera?

迷茫迷茫2813 days ago635

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-02 09:35:20

    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.

    reply
    0
  • Cancelreply