Reference

Photo Deletion Flow (PhotoKit)

On iOS, apps delete photos through PhotoKit by wrapping PHAssetChangeRequest.deleteAssets in PHPhotoLibrary.performChanges. iOS shows a system confirmation the user must approve, and the photos move to Recently Deleted for ~30 days rather than being erased immediately.

iOS developmentiOSiPadOS

Photo Deletion Flow (PhotoKit)

Also known as: delete photos programmatically ios, performchanges delete, ios photo deletion, deleteAssets PhotoKit

On iOS, apps delete photos through PhotoKit by wrapping PHAssetChangeRequest.deleteAssets in PHPhotoLibrary.performChanges. iOS shows a system confirmation the user must approve, and the photos move to Recently Deleted for ~30 days rather than being erased immediately.

  • Deletions go through PHPhotoLibrary.performChanges wrapping PHAssetChangeRequest.deleteAssets — there is no direct file access.
  • iOS shows a mandatory system confirmation for third-party deletes; the user must approve before anything is removed.
  • Deleted photos sit in Recently Deleted for about 30 days, so space is not reclaimed until that album is purged.

How a third-party app deletes a photo

Apps cannot reach into the photo library's files directly. They use PhotoKit: fetch the items as PHAsset objects, then submit a change inside PHPhotoLibrary.shared().performChanges { … } that calls PHAssetChangeRequest.deleteAssets(_:) (or deleteAssets on a collection-change request). The completion handler reports success or an error.

Crucially, when a non-system app requests a deletion, iOS itself presents a confirmation alert ("Allow [App] to delete N photos?"). The user must tap Delete for the change to commit; if they cancel, performChanges returns an error and nothing is removed. This consent prompt is enforced by the OS and cannot be bypassed or pre-checked away by the app, which is what makes batch cleanup safe.

Authorization and Recently Deleted

Before any of this, the app needs Photos access via PHPhotoLibrary.requestAuthorization(for: .readWrite). With the limited-library option a user may grant access to only selected assets; deletion still flows through the same performChanges call for whatever assets the app can see.

A successful delete does not free space instantly. The assets move to the Recently Deleted album, where they remain for about 30 days (and are excluded from the main library) before iOS purges them. Until then they still occupy storage, and purgeable space plus iCloud sync further blur how quickly the freed capacity appears. Emptying Recently Deleted manually finalizes the removal.

Why Cleanor uses this flow

Cleanor identifies duplicate and similar photos with on-device perceptual hashing, then deletes the ones you choose through the standard PhotoKit deleteAssets path. Because the OS-level confirmation always appears and items land in Recently Deleted, the user keeps a 30-day safety net and full control — the app never silently removes a photo. This is the only Apple-sanctioned way for a cleaner to remove library photos.

Related terms

Keep reading the reference.

Recommended solution

The curated tool collection for this kind of cleanup.

Act on it

Guides and tools for this topic.