PhotoKit

RSS for tag

Work with image and video assets managed by the Photos app, including those from iCloud Photos and Live Photos, using PhotoKit.

Posts under PhotoKit tag

200 Posts

Post

Replies

Boosts

Views

Activity

PHAssetChangeRequest deleteAssets completionHandler for recently captured 48MP DNG sometimes never called
I want to report a issue on PHAssetChangeRequest.deleteAssets Environment iOS 18.5, iOS 26.2.5, iOS 27.0 Steps to Reproduce Capture a 48MP ProRAW (DNG) photo with the Camera app. Open my app, call the following api to delete this photo: PHPhotoLibrary.shared().performChanges({ PHAssetChangeRequest.deleteAssets(assets) }, completionHandler: completionHandler) Expected The system delete-confirmation dialog appears; after the user confirms, the asset is deleted and the completionHandler is called or report error if it failed Actual Sometime the following issue happens: The confirmation dialog never appears and the completionHandler is never called no success, no error, no timeout. The built-in Photos app can delete the affected asset but API can't. The stuck request leaks permanently. Even after the same asset is subsequently deleted via the built-in Photos app, the pending completionHandler is still never invoked. Workaround for this issue When the issue happens, restarting the iPhone or reinstall app can not help to fix it But I found if I leave the device alone for an extended period (maybe 10 min~1 hour) and restart the iPhone, finally I found PHAssetChangeRequest.deleteAssets work again. It looks like some background task for 48MP RAW image in DNG format stuck delete API. I need to wait the task finished and restart device to reset stuck status. But I can not know when the DNG is ready to delete, it looks like my app hangs I think the better behavior is completion block should return a error to tell user what happens instead of not calling completion block.
2
0
1.2k
18h
Does the PhotoKit fix in iOS 27 beta 3 also cover PHImageManager requests that never call back?
I previously reported an issue where PHImageManager.requestImageDataAndOrientation() never calls its progress or completion handler. In this thread, it was mentioned that iOS 27 beta 3 fixes a PhotoKit hang involving the deletion of recently captured 48 MP ProRAW assets. I know these involve different APIs (PHPhotoLibrary and PHImageManager). But the behavior looks the same. The request hangs without ever calling back, and later PhotoKit requests get stuck as well. Will the PHImageManager issue I reported also be fixed when iOS 27 is officially released?
0
0
450
2d
EXIF metadata is stripped when creating an asset via addResource(with:.photo, data:) on iOS 26.6
Starting with iOS 26.6, saving an image to the photo library via PHAssetCreationRequest.addResource(with: .photo, data:, options:) appears to re-encode the image, dropping all EXIF metadata. The same code preserved metadata through iOS 26.5. let creationRequest = PHAssetCreationRequest.forAsset() creationRequest.addResource(with: .photo, data: image, options: nil) I would like to know whether this change is intentional, and whether the file-based overload is the supported way to preserve an image's original metadata. What we verified The bytes we hand to PhotoKit still contain the metadata. Setting contentType explicitly does not help. We resolved the type from the data and confirmed at runtime that it was non-nil (public.jpeg): let options = PHAssetResourceCreationOptions() if #available(iOS 26.0, *) { options.contentType = contentType // verified: UTType.jpeg, not nil } let request = PHAssetCreationRequest.forAsset() request.addResource(with: .photo, data: imageData, options: options) The resulting asset still has no EXIF. Writing the identical bytes to a temporary file and using the file-based overload preserves everything: try imageData.write(to: temporaryFileURL, options: .atomic) let options = PHAssetResourceCreationOptions() options.shouldMoveFile = true let request = PHAssetCreationRequest.forAsset() request.addResource(with: .photo, fileURL: temporaryFileURL, options: options) Capture date, camera information and location are all intact. We access the library with PHAccessLevel.addOnly.
0
0
436
2d
iOS 26.6.2: Live Photos Fail to Save (Only When Using the JPEG+MOV Combination)
On iOS 26.6.2, Live Photos fail to save. This issue does not occur on iOS 27.0 RC. Devices Experiencing Issues iPhone 17 (iOS 26.6.2) iPhone 17 Pro MAX(iOS 26.6.2) iPad mini 5th generation (iPadOS 26.6.2) and might be others... Description 1. For HEVC+MOV, the Livephoto is saved successfully. If you write the code exactly as shown in the official instruction the Live Photo will be saved successfully. However, the reference code uses a combination of HEVC and MOV. let photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.hevc]) 2. For JPEG+MOV, Livephoto saving fails. Some users prefer JPEG files, which offer high compatibility. Therefore, we'll modify the code as follows. let photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.jpeg]) In this case, the AVFoundation recording process itself succeeds, but when attempting to save the result to the photo library using PhotoKit, it fails with the following error. error:The operation couldn’t be completed. (PHPhotosErrorDomain error 3302.) key: __NSCFString = "_PHResourceUrlsErrorKey" Here is the code for saving Live Photos. (This is exactly the same as the code in the official reference.) PHPhotoLibrary.shared().performChanges({ let creationRequest = PHAssetCreationRequest.forAsset() creationRequest.addResource(with: .photo, data: stillImageData, options: nil) let options = PHAssetResourceCreationOptions() options.shouldMoveFile = true creationRequest.addResource(with: .pairedVideo, fileURL: livePhotoMovieURL, options: options) }) { success, error in // Handle completion. } We've posted to Apple Feedback with Sysdiagnose. FB24760461
0
0
480
3d
PHPhotoLibrary.performChanges completionHandler not called when deleting assets on iOS 26
In my app, I use api provided in Photos framework to delete specified photo. But after upgrading to iOS 26, the delete function in some iOS device no longer work. The api will never triggers the system confirmation dialog, and the completionHandler is never called. In the iOS Photos app, deletion works correctly on the same assets, but calling the API from my app does not work. Steps to Reproduce Make sure the app has Full Photo Library Access. Execute the following code: PHPhotoLibrary.shared().performChanges({ let assetsToBeDeleted = PHAsset.fetchAssets(withLocalIdentifiers: delUrls, options: nil) PHAssetChangeRequest.deleteAssets(assetsToBeDeleted) }, completionHandler: completionHandler) Expected Behavior The system should present a confirmation dialog asking the user to delete the selected photos. After the user confirms, the deletion should occur, and the completionHandler should be called with success or error. Actual Behavior The system delete confirmation dialog does not appear. The completionHandler is never called. Environment iOS Versions: 26.1 / 26.0.1 It looks like api bug. I want to check Is it a know issue and will be fixed. Thanks
5
2
1.2k
3d
On iOS 26.6.1 and 26.6.2, Exif (XResolution / YResolution) values become 0 when an image attached in the Gmail app is saved to the Photos app
My app is built with Xcode 26.1 and uses a customized photo picker implemented with the PhotoKit Framework. After saving an image attached in the Gmail app to the Photos app on iOS 26.6.1 or iOS 26.6.2, when my app selects and loads that image, the Exif XResolution and YResolution values are both reported as 0. Is this an iOS bug? The following code retrieves the XResolution and YResolution values from the PHAsset of the selected image. private func selectAsset(_ asset: PHAsset) { let options = PHImageRequestOptions() options.isNetworkAccessAllowed = true options.deliveryMode = .highQualityFormat PHImageManager.default().requestImageDataAndOrientation(for: asset, options: options) { data, _, _, _ in DispatchQueue.main.async { if let data { let options = PHImageRequestOptions() options.isNetworkAccessAllowed = true options.deliveryMode = .highQualityFormat PHImageManager.default().requestImageDataAndOrientation(for: asset, options: options) { data, _, _, _ in guard let data, let source = CGImageSourceCreateWithData(data as CFData, nil), let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any], let tiff = properties[kCGImagePropertyTIFFDictionary] as? [CFString: Any] else { print("XResolution: NaN, YResolution: NaN") return } let xResolution = tiff[kCGImagePropertyTIFFXResolution] as? Double let yResolution = tiff[kCGImagePropertyTIFFYResolution] as? Double print("XResolution: \(xResolution.map { String($0) } ?? "NaN"), YResolution: \(yResolution.map { String($0) } ?? "NaN")") } } } } } Result on iOS 26.6 XResolution: 72, YResolution: 72 Result on iOS 26.6.1 and 26.6.2 XResolution: 0, YResolution: 0
1
0
90
5d
PhotoKit IMG_XXXX names for videos?
I save stills and videos with PHAssetCreationRequest. I do not set originalFilename. Photos saved with addResource(with: .photo, data:) show originalFilename values like IMG_XXXX.HEIC in PHAssetResource. Videos saved with addResource(with: .video, fileURL:) from AVCaptureMovieFileOutput keep the temp file name (a UUID .mov). The docs say that if originalFilename is omitted, Photos infers a name from the file URL when one is provided, otherwise it generates a name. Is there a supported way for a third-party app to get a system IMG_XXXX original filename for a newly saved video? Thank you.
1
0
649
2w
Display HDR images for PhotoKit assets
In my app I get a UIImage for a PHAsset via PHImageManager.requestImage(for:targetSize:contentMode:options:resultHandler:). I directly display that image in a UIImageView that has preferredImageDynamicRange set to .high. The problem is I do not see the high dynamic range. I see the HDRDemo23 sample code uses PhotosPicker to get a UIImage from Data through UIImageReader whose config enables prefersHighDynamicRange. Is there a way to support HDR when using the Photos APIs to request display images? And is there support for PHLivePhoto displayed in PHLivePhotoView retrieved via PHImageManager.requestLivePhoto?
5
1
2.1k
2w
How to utilize PHLivePhotoRequestOptions.preferHDR to support HDR in Live Photos?
The iOS 27 SDK newly exposed PHLivePhotoRequestOptions.preferHDR. Its documentation states: For best results, only enable this when you intend to display an HDR experience in PHLivePhotoView — for example, when the view’s preferredImageDynamicRange is greater than standard (SDR). PHLivePhotoView has no preferredImageDynamicRange property. How is this API to be used then?
0
0
311
2w
PHAssetResource deprecated originalFilename replaced with filename, but PHAssetExtendedMetadata only has originalFilename in iOS 27
PHAssetExtendedMetadata has the following API: /// The original file name of this asset. open var originalFilename: String? { get } And PHAssetResource has the following API: @available(iOS, introduced: 9, deprecated: 27, message: "Use filename instead") open var originalFilename: String { get } /// The filename associated with this asset resource (if any) @available(iOS 27, *) open var filename: String? { get } I'm confused why PHAssetExtendedMetadata (iOS 27+) has originalFilename while PHAssetResource originalFilename was deprecated and replaced with filename. I would have expected PHAssetExtendedMetadata's property be named filename to match. Are all 3 of these all the exact same name or can there be differences?
1
0
364
3w
Add a value to the Photos Caption field
In the iOS Photos app there is a caption field the user can write to. How can you write to this value from Swift when creating a photo? I see apps that do this, but there doesn't seem to be any official way to do this using the Photo library through PHAssetCreationRequest or PHAssetResourceCreationOptions or setting EXIF values, I tried settings a bunch of values there including IPTC values but nothing appears in the caption field in the iOS photos app. There must be some way to do it since I see other apps setting that value somehow after capturing a photo.
2
1
883
Jul ’26
Request photo library authorization popup on macOS Catalyst can't be dismissed
I have an iOS app that I want to publish to the Mac App Store as a Catalyst app, but I noticed a situation where the app can't be closed and has to be force quit. The problem happens if the user has 0 photos in their Photo Library, and hits "Limited Access" on the request authorization prompt (In my case PHPhotoLibrary.requestAuthorization(for: .readWrite). Since the popup is a system prompt, I can't manually add a close button to it. I tried wrapping it in a view with a close button but the popup always shows up over any view I'm presenting within my app. If anyone has a workaround that would be greatly appreciated!
2
0
593
Jul ’26
PHPickerViewController: UI rendering failure and data retrieval errors on iOS 17 & 26.4
Description: I am encountering critical issues with PHPickerViewController using the "Zero-Permission" configuration. The behavior differs significantly between iOS 17 and iOS 26.4, but both prevent successful image selection. Observed Behaviors: On iOS 26.4 (iPhone 17 Pro Max): The PHPicker UI fails to render the photo grid entirely. Upon initialization, the system UI displays an "Unable to load photo" alert, preventing users from even viewing or selecting images. On iOS 17: The picker UI loads, but after the user selects an image and adds it, the subsequent itemProvider.loadObject call consistently fails, returning an error and preventing our app from retrieving the image data. Current Implementation: var config = PHPickerConfiguration() config.filter = .images config.selectionLimit = pickLimit // Problematic logic: if ABTestManager.shared.isPHPickerCurrent { config.preferredAssetRepresentationMode = .current } let pickerVC = PHPickerViewController(configuration: config) pickerVC.delegate = self user device Images: What I have tested: I have been using preferredAssetRepresentationMode = .current in my AB tests. I have not yet tested .compatible mode, as my application logic requires access to high-fidelity assets. However, the current behavior suggests a regression or a fundamental incompatibility with how the system handles image containers for high-end hardware (e.g., iPhone 17 Pro Max) in the out-of-process picker. Supporting Documentation: Minimal Reproducible Project: [Attached] Logs: [Attached sysdiagnose logs] My Questions: Is the "Unable to load photo" UI failure on iOS 26.4 a known limitation for certain high-resolution asset types when using .current mode? Are there specific handling requirements for NSItemProvider when the system fails to resolve the image data in .current mode on older iOS 17 devices? Given that these failures occur in a "Zero-Permission" context, are there specific metadata or image processing constraints I should be aware of to prevent the picker from entering a "failed" state?
2
1
300
Jun ’26
Best practice for rapid sequential Live Photo captures with AVCapturePhotoOutput?
Hi everyone, I’m working on a camera app as a learning project and have reached a point where I’m trying to better understand the intended architecture for Live Photo capture using AVCapturePhotoOutput. The app currently supports: Live Photos Depth data Location metadata Multiple lens presets on a virtual multi-camera device Everything is working well, but I’m now thinking about capture throughput and rapid shutter presses. Right now, my implementation is fairly conservative. I wait for a Live Photo capture to finish processing and importing before allowing another capture. This is reliable, but it doesn’t feel particularly camera-like when compared to Apple’s Camera app. One observation from field testing caught my attention: I took a Live Photo, immediately switched lenses, then took another Live Photo. When I viewed the first Live Photo later, the movie portion included the lens-switching actions that occurred after I pressed the shutter. That made me realize that I may be thinking about the capture lifecycle incorrectly. My questions are: When using AVCapturePhotoOutput with Live Photos enabled, what is the earliest point at which a capture can be considered “safely secured”? Is it expected that apps wait for PhotoKit import to complete before accepting another Live Photo capture request? If supporting rapid sequential shutter presses, is the recommended approach to queue capture requests and process them one at a time? Are there any best practices around lens changes or camera reconfiguration while a Live Photo is still being captured or processed? I’m not looking for details about the implementation of Apple’s Camera app. I’m mainly trying to understand the recommended approach when working with the public AVFoundation APIs. I’d appreciate any guidance, documentation references, or examples from developers who have worked through similar problems. Thanks!
1
0
986
Jun ’26
PHAssetResourceUploadJobChangeRequest doesn't upload iCloud-optimized photos — is this expected?
I'm implementing PHBackgroundResourceUploadExtension to back up photos and videos to our cloud storage service. During testing, I observed that iCloud-optimized photos (where the full-resolution original is stored in iCloud, not on device) do not upload. The upload job appears to silently skip these assets. Questions: Is this behavior intentional/documented? I couldn't find explicit mention of this limitation. If the device only has the optimized/thumbnail version locally, does the system: - Automatically download the full-resolution asset from iCloud before uploading? - Skip the asset entirely? - Return an error via PHAssetResourceUploadJobChangeRequest? For a complete backup solution, should we: - Pre-fetch full-resolution assets using PHAssetResourceManager.requestData(for:options:) before creating upload jobs? - Use a hybrid approach (this extension for local assets + separate logic for iCloud-only assets)? Environment: iOS 26, Xcode 18
1
1
910
Jun ’26
How to upload large videos with PHAssetResourceUploadJobChangeRequest?
I'm implementing a PHBackgroundResourceUploadExtension to back up photos and videos from the user's library to our cloud storage service. Our existing upload infrastructure uses chunked uploads for large files (splitting videos into smaller byte ranges and uploading each chunk separately). This approach: Allows resumable uploads if interrupted Stays within server-side request size limits Provides granular progress tracking Looking at the PHAssetResourceUploadJobChangeRequest.createJob(destination:resource:) API, I don't see a way to specify byte ranges or create multiple jobs for chunks of the same resource. Questions: Does the system handle large files (1GB+) automatically under the hood, or is there a recommended maximum file size for a single upload job? Is there a supported pattern for chunked/resumable uploads, or should the destination URL endpoint handle the entire file in one request? If our server requires chunked uploads (e.g., BITS protocol with CreateSession → Fragment → CloseSession), is this extension the right mechanism, or should we use a different approach for large videos? Any guidance on best practices for large asset uploads would be greatly appreciated. Environment: iOS 26, Xcode 18
5
1
1.7k
Jun ’26
PHPickerConfiguration.preselectedAssetIdentifiers not work
let authStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite) let fetchResult = PHAsset.fetchAssets(withLocalIdentifiers: selectedAssetIDs, options: nil) print("[AlbumCreation] authStatus=\(authStatus.rawValue) IDs=\(selectedAssetIDs.count) PHAsset匹配=\(fetchResult.count)") // result is: [AlbumCreation] authStatus=3 IDs=3 PHAsset匹配=3 var config = PHPickerConfiguration(photoLibrary: .shared()) config.preselectedAssetIdentifiers = selectedAssetIDs config.selectionLimit = 0 let picker = PHPickerViewController(configuration: config) picker.delegate = self present(picker, animated: true)
1
0
428
May ’26
PHPhotosErrorDomain Code: 3302 started affecting my users recently.
Recently I received multiple user email supports because the app cannot save video to photos, they are all on iOS 26.x The code in my app around recording video and saving to Photos hasn't changed in years. I'm not able to reproduce it locally, I tried on all my available devices. In recently published build I added additional logs and it appears that all of cases that fail with 3302 have the photos access set to "Limited Access". It never happens to users with "Full Access". In that build I also added a fallback, when saving to photos fails, the app saves to Documents and it seems it works (two of my users affected users confirmed it), but it's very unfortunate. I think it kind of proves that videos aren't broken given that users are able to play them just fine. On of users says that for him saving to Photos works for 2-3 times after he reinstalls the app and then it stops working. Did anything recently changed in how we should save videos to photos? I'm using the following code. I can see in git blame that I haven't changed in since 2020 and never encountered those errors in development or heard about those issues until around 1 month ago. Thank you. PHPhotoLibrary.shared().performChanges { PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: fileURL) } completionHandler: { success, error in
2
0
686
Apr ’26
PHAssetChangeRequest deleteAssets completionHandler for recently captured 48MP DNG sometimes never called
I want to report a issue on PHAssetChangeRequest.deleteAssets Environment iOS 18.5, iOS 26.2.5, iOS 27.0 Steps to Reproduce Capture a 48MP ProRAW (DNG) photo with the Camera app. Open my app, call the following api to delete this photo: PHPhotoLibrary.shared().performChanges({ PHAssetChangeRequest.deleteAssets(assets) }, completionHandler: completionHandler) Expected The system delete-confirmation dialog appears; after the user confirms, the asset is deleted and the completionHandler is called or report error if it failed Actual Sometime the following issue happens: The confirmation dialog never appears and the completionHandler is never called no success, no error, no timeout. The built-in Photos app can delete the affected asset but API can't. The stuck request leaks permanently. Even after the same asset is subsequently deleted via the built-in Photos app, the pending completionHandler is still never invoked. Workaround for this issue When the issue happens, restarting the iPhone or reinstall app can not help to fix it But I found if I leave the device alone for an extended period (maybe 10 min~1 hour) and restart the iPhone, finally I found PHAssetChangeRequest.deleteAssets work again. It looks like some background task for 48MP RAW image in DNG format stuck delete API. I need to wait the task finished and restart device to reset stuck status. But I can not know when the DNG is ready to delete, it looks like my app hangs I think the better behavior is completion block should return a error to tell user what happens instead of not calling completion block.
Replies
2
Boosts
0
Views
1.2k
Activity
18h
Does the PhotoKit fix in iOS 27 beta 3 also cover PHImageManager requests that never call back?
I previously reported an issue where PHImageManager.requestImageDataAndOrientation() never calls its progress or completion handler. In this thread, it was mentioned that iOS 27 beta 3 fixes a PhotoKit hang involving the deletion of recently captured 48 MP ProRAW assets. I know these involve different APIs (PHPhotoLibrary and PHImageManager). But the behavior looks the same. The request hangs without ever calling back, and later PhotoKit requests get stuck as well. Will the PHImageManager issue I reported also be fixed when iOS 27 is officially released?
Replies
0
Boosts
0
Views
450
Activity
2d
EXIF metadata is stripped when creating an asset via addResource(with:.photo, data:) on iOS 26.6
Starting with iOS 26.6, saving an image to the photo library via PHAssetCreationRequest.addResource(with: .photo, data:, options:) appears to re-encode the image, dropping all EXIF metadata. The same code preserved metadata through iOS 26.5. let creationRequest = PHAssetCreationRequest.forAsset() creationRequest.addResource(with: .photo, data: image, options: nil) I would like to know whether this change is intentional, and whether the file-based overload is the supported way to preserve an image's original metadata. What we verified The bytes we hand to PhotoKit still contain the metadata. Setting contentType explicitly does not help. We resolved the type from the data and confirmed at runtime that it was non-nil (public.jpeg): let options = PHAssetResourceCreationOptions() if #available(iOS 26.0, *) { options.contentType = contentType // verified: UTType.jpeg, not nil } let request = PHAssetCreationRequest.forAsset() request.addResource(with: .photo, data: imageData, options: options) The resulting asset still has no EXIF. Writing the identical bytes to a temporary file and using the file-based overload preserves everything: try imageData.write(to: temporaryFileURL, options: .atomic) let options = PHAssetResourceCreationOptions() options.shouldMoveFile = true let request = PHAssetCreationRequest.forAsset() request.addResource(with: .photo, fileURL: temporaryFileURL, options: options) Capture date, camera information and location are all intact. We access the library with PHAccessLevel.addOnly.
Replies
0
Boosts
0
Views
436
Activity
2d
iOS 26.6.2: Live Photos Fail to Save (Only When Using the JPEG+MOV Combination)
On iOS 26.6.2, Live Photos fail to save. This issue does not occur on iOS 27.0 RC. Devices Experiencing Issues iPhone 17 (iOS 26.6.2) iPhone 17 Pro MAX(iOS 26.6.2) iPad mini 5th generation (iPadOS 26.6.2) and might be others... Description 1. For HEVC+MOV, the Livephoto is saved successfully. If you write the code exactly as shown in the official instruction the Live Photo will be saved successfully. However, the reference code uses a combination of HEVC and MOV. let photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.hevc]) 2. For JPEG+MOV, Livephoto saving fails. Some users prefer JPEG files, which offer high compatibility. Therefore, we'll modify the code as follows. let photoSettings = AVCapturePhotoSettings(format: [AVVideoCodecKey: AVVideoCodecType.jpeg]) In this case, the AVFoundation recording process itself succeeds, but when attempting to save the result to the photo library using PhotoKit, it fails with the following error. error:The operation couldn’t be completed. (PHPhotosErrorDomain error 3302.) key: __NSCFString = "_PHResourceUrlsErrorKey" Here is the code for saving Live Photos. (This is exactly the same as the code in the official reference.) PHPhotoLibrary.shared().performChanges({ let creationRequest = PHAssetCreationRequest.forAsset() creationRequest.addResource(with: .photo, data: stillImageData, options: nil) let options = PHAssetResourceCreationOptions() options.shouldMoveFile = true creationRequest.addResource(with: .pairedVideo, fileURL: livePhotoMovieURL, options: options) }) { success, error in // Handle completion. } We've posted to Apple Feedback with Sysdiagnose. FB24760461
Replies
0
Boosts
0
Views
480
Activity
3d
PHPhotoLibrary.performChanges completionHandler not called when deleting assets on iOS 26
In my app, I use api provided in Photos framework to delete specified photo. But after upgrading to iOS 26, the delete function in some iOS device no longer work. The api will never triggers the system confirmation dialog, and the completionHandler is never called. In the iOS Photos app, deletion works correctly on the same assets, but calling the API from my app does not work. Steps to Reproduce Make sure the app has Full Photo Library Access. Execute the following code: PHPhotoLibrary.shared().performChanges({ let assetsToBeDeleted = PHAsset.fetchAssets(withLocalIdentifiers: delUrls, options: nil) PHAssetChangeRequest.deleteAssets(assetsToBeDeleted) }, completionHandler: completionHandler) Expected Behavior The system should present a confirmation dialog asking the user to delete the selected photos. After the user confirms, the deletion should occur, and the completionHandler should be called with success or error. Actual Behavior The system delete confirmation dialog does not appear. The completionHandler is never called. Environment iOS Versions: 26.1 / 26.0.1 It looks like api bug. I want to check Is it a know issue and will be fixed. Thanks
Replies
5
Boosts
2
Views
1.2k
Activity
3d
On iOS 26.6.1 and 26.6.2, Exif (XResolution / YResolution) values become 0 when an image attached in the Gmail app is saved to the Photos app
My app is built with Xcode 26.1 and uses a customized photo picker implemented with the PhotoKit Framework. After saving an image attached in the Gmail app to the Photos app on iOS 26.6.1 or iOS 26.6.2, when my app selects and loads that image, the Exif XResolution and YResolution values are both reported as 0. Is this an iOS bug? The following code retrieves the XResolution and YResolution values from the PHAsset of the selected image. private func selectAsset(_ asset: PHAsset) { let options = PHImageRequestOptions() options.isNetworkAccessAllowed = true options.deliveryMode = .highQualityFormat PHImageManager.default().requestImageDataAndOrientation(for: asset, options: options) { data, _, _, _ in DispatchQueue.main.async { if let data { let options = PHImageRequestOptions() options.isNetworkAccessAllowed = true options.deliveryMode = .highQualityFormat PHImageManager.default().requestImageDataAndOrientation(for: asset, options: options) { data, _, _, _ in guard let data, let source = CGImageSourceCreateWithData(data as CFData, nil), let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any], let tiff = properties[kCGImagePropertyTIFFDictionary] as? [CFString: Any] else { print("XResolution: NaN, YResolution: NaN") return } let xResolution = tiff[kCGImagePropertyTIFFXResolution] as? Double let yResolution = tiff[kCGImagePropertyTIFFYResolution] as? Double print("XResolution: \(xResolution.map { String($0) } ?? "NaN"), YResolution: \(yResolution.map { String($0) } ?? "NaN")") } } } } } Result on iOS 26.6 XResolution: 72, YResolution: 72 Result on iOS 26.6.1 and 26.6.2 XResolution: 0, YResolution: 0
Replies
1
Boosts
0
Views
90
Activity
5d
PhotoKit IMG_XXXX names for videos?
I save stills and videos with PHAssetCreationRequest. I do not set originalFilename. Photos saved with addResource(with: .photo, data:) show originalFilename values like IMG_XXXX.HEIC in PHAssetResource. Videos saved with addResource(with: .video, fileURL:) from AVCaptureMovieFileOutput keep the temp file name (a UUID .mov). The docs say that if originalFilename is omitted, Photos infers a name from the file URL when one is provided, otherwise it generates a name. Is there a supported way for a third-party app to get a system IMG_XXXX original filename for a newly saved video? Thank you.
Replies
1
Boosts
0
Views
649
Activity
2w
Display HDR images for PhotoKit assets
In my app I get a UIImage for a PHAsset via PHImageManager.requestImage(for:targetSize:contentMode:options:resultHandler:). I directly display that image in a UIImageView that has preferredImageDynamicRange set to .high. The problem is I do not see the high dynamic range. I see the HDRDemo23 sample code uses PhotosPicker to get a UIImage from Data through UIImageReader whose config enables prefersHighDynamicRange. Is there a way to support HDR when using the Photos APIs to request display images? And is there support for PHLivePhoto displayed in PHLivePhotoView retrieved via PHImageManager.requestLivePhoto?
Replies
5
Boosts
1
Views
2.1k
Activity
2w
How to utilize PHLivePhotoRequestOptions.preferHDR to support HDR in Live Photos?
The iOS 27 SDK newly exposed PHLivePhotoRequestOptions.preferHDR. Its documentation states: For best results, only enable this when you intend to display an HDR experience in PHLivePhotoView — for example, when the view’s preferredImageDynamicRange is greater than standard (SDR). PHLivePhotoView has no preferredImageDynamicRange property. How is this API to be used then?
Replies
0
Boosts
0
Views
311
Activity
2w
PHAssetResource deprecated originalFilename replaced with filename, but PHAssetExtendedMetadata only has originalFilename in iOS 27
PHAssetExtendedMetadata has the following API: /// The original file name of this asset. open var originalFilename: String? { get } And PHAssetResource has the following API: @available(iOS, introduced: 9, deprecated: 27, message: "Use filename instead") open var originalFilename: String { get } /// The filename associated with this asset resource (if any) @available(iOS 27, *) open var filename: String? { get } I'm confused why PHAssetExtendedMetadata (iOS 27+) has originalFilename while PHAssetResource originalFilename was deprecated and replaced with filename. I would have expected PHAssetExtendedMetadata's property be named filename to match. Are all 3 of these all the exact same name or can there be differences?
Replies
1
Boosts
0
Views
364
Activity
3w
Add a value to the Photos Caption field
In the iOS Photos app there is a caption field the user can write to. How can you write to this value from Swift when creating a photo? I see apps that do this, but there doesn't seem to be any official way to do this using the Photo library through PHAssetCreationRequest or PHAssetResourceCreationOptions or setting EXIF values, I tried settings a bunch of values there including IPTC values but nothing appears in the caption field in the iOS photos app. There must be some way to do it since I see other apps setting that value somehow after capturing a photo.
Replies
2
Boosts
1
Views
883
Activity
Jul ’26
PHAsset Additional Properties
Following Metadata should be accessible from PHAsset Object: Title, caption, Keywords. Write now they are available in the SQLite Photo Library, but thats is not a clean solution.
Replies
2
Boosts
4
Views
898
Activity
Jul ’26
Request photo library authorization popup on macOS Catalyst can't be dismissed
I have an iOS app that I want to publish to the Mac App Store as a Catalyst app, but I noticed a situation where the app can't be closed and has to be force quit. The problem happens if the user has 0 photos in their Photo Library, and hits "Limited Access" on the request authorization prompt (In my case PHPhotoLibrary.requestAuthorization(for: .readWrite). Since the popup is a system prompt, I can't manually add a close button to it. I tried wrapping it in a view with a close button but the popup always shows up over any view I'm presenting within my app. If anyone has a workaround that would be greatly appreciated!
Replies
2
Boosts
0
Views
593
Activity
Jul ’26
PHPickerViewController: UI rendering failure and data retrieval errors on iOS 17 & 26.4
Description: I am encountering critical issues with PHPickerViewController using the "Zero-Permission" configuration. The behavior differs significantly between iOS 17 and iOS 26.4, but both prevent successful image selection. Observed Behaviors: On iOS 26.4 (iPhone 17 Pro Max): The PHPicker UI fails to render the photo grid entirely. Upon initialization, the system UI displays an "Unable to load photo" alert, preventing users from even viewing or selecting images. On iOS 17: The picker UI loads, but after the user selects an image and adds it, the subsequent itemProvider.loadObject call consistently fails, returning an error and preventing our app from retrieving the image data. Current Implementation: var config = PHPickerConfiguration() config.filter = .images config.selectionLimit = pickLimit // Problematic logic: if ABTestManager.shared.isPHPickerCurrent { config.preferredAssetRepresentationMode = .current } let pickerVC = PHPickerViewController(configuration: config) pickerVC.delegate = self user device Images: What I have tested: I have been using preferredAssetRepresentationMode = .current in my AB tests. I have not yet tested .compatible mode, as my application logic requires access to high-fidelity assets. However, the current behavior suggests a regression or a fundamental incompatibility with how the system handles image containers for high-end hardware (e.g., iPhone 17 Pro Max) in the out-of-process picker. Supporting Documentation: Minimal Reproducible Project: [Attached] Logs: [Attached sysdiagnose logs] My Questions: Is the "Unable to load photo" UI failure on iOS 26.4 a known limitation for certain high-resolution asset types when using .current mode? Are there specific handling requirements for NSItemProvider when the system fails to resolve the image data in .current mode on older iOS 17 devices? Given that these failures occur in a "Zero-Permission" context, are there specific metadata or image processing constraints I should be aware of to prevent the picker from entering a "failed" state?
Replies
2
Boosts
1
Views
300
Activity
Jun ’26
Best practice for rapid sequential Live Photo captures with AVCapturePhotoOutput?
Hi everyone, I’m working on a camera app as a learning project and have reached a point where I’m trying to better understand the intended architecture for Live Photo capture using AVCapturePhotoOutput. The app currently supports: Live Photos Depth data Location metadata Multiple lens presets on a virtual multi-camera device Everything is working well, but I’m now thinking about capture throughput and rapid shutter presses. Right now, my implementation is fairly conservative. I wait for a Live Photo capture to finish processing and importing before allowing another capture. This is reliable, but it doesn’t feel particularly camera-like when compared to Apple’s Camera app. One observation from field testing caught my attention: I took a Live Photo, immediately switched lenses, then took another Live Photo. When I viewed the first Live Photo later, the movie portion included the lens-switching actions that occurred after I pressed the shutter. That made me realize that I may be thinking about the capture lifecycle incorrectly. My questions are: When using AVCapturePhotoOutput with Live Photos enabled, what is the earliest point at which a capture can be considered “safely secured”? Is it expected that apps wait for PhotoKit import to complete before accepting another Live Photo capture request? If supporting rapid sequential shutter presses, is the recommended approach to queue capture requests and process them one at a time? Are there any best practices around lens changes or camera reconfiguration while a Live Photo is still being captured or processed? I’m not looking for details about the implementation of Apple’s Camera app. I’m mainly trying to understand the recommended approach when working with the public AVFoundation APIs. I’d appreciate any guidance, documentation references, or examples from developers who have worked through similar problems. Thanks!
Replies
1
Boosts
0
Views
986
Activity
Jun ’26
PHAssetResourceUploadJobChangeRequest doesn't upload iCloud-optimized photos — is this expected?
I'm implementing PHBackgroundResourceUploadExtension to back up photos and videos to our cloud storage service. During testing, I observed that iCloud-optimized photos (where the full-resolution original is stored in iCloud, not on device) do not upload. The upload job appears to silently skip these assets. Questions: Is this behavior intentional/documented? I couldn't find explicit mention of this limitation. If the device only has the optimized/thumbnail version locally, does the system: - Automatically download the full-resolution asset from iCloud before uploading? - Skip the asset entirely? - Return an error via PHAssetResourceUploadJobChangeRequest? For a complete backup solution, should we: - Pre-fetch full-resolution assets using PHAssetResourceManager.requestData(for:options:) before creating upload jobs? - Use a hybrid approach (this extension for local assets + separate logic for iCloud-only assets)? Environment: iOS 26, Xcode 18
Replies
1
Boosts
1
Views
910
Activity
Jun ’26
How to upload large videos with PHAssetResourceUploadJobChangeRequest?
I'm implementing a PHBackgroundResourceUploadExtension to back up photos and videos from the user's library to our cloud storage service. Our existing upload infrastructure uses chunked uploads for large files (splitting videos into smaller byte ranges and uploading each chunk separately). This approach: Allows resumable uploads if interrupted Stays within server-side request size limits Provides granular progress tracking Looking at the PHAssetResourceUploadJobChangeRequest.createJob(destination:resource:) API, I don't see a way to specify byte ranges or create multiple jobs for chunks of the same resource. Questions: Does the system handle large files (1GB+) automatically under the hood, or is there a recommended maximum file size for a single upload job? Is there a supported pattern for chunked/resumable uploads, or should the destination URL endpoint handle the entire file in one request? If our server requires chunked uploads (e.g., BITS protocol with CreateSession → Fragment → CloseSession), is this extension the right mechanism, or should we use a different approach for large videos? Any guidance on best practices for large asset uploads would be greatly appreciated. Environment: iOS 26, Xcode 18
Replies
5
Boosts
1
Views
1.7k
Activity
Jun ’26
A few issues with the iPhone Photos app
I’m curious what framework and rendering technique you’re using for the photo album’s grid zoom in and out. Why is it so incredibly smooth? I can’t seem to pull that off 🤦‍♂️
Replies
2
Boosts
0
Views
639
Activity
May ’26
PHPickerConfiguration.preselectedAssetIdentifiers not work
let authStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite) let fetchResult = PHAsset.fetchAssets(withLocalIdentifiers: selectedAssetIDs, options: nil) print("[AlbumCreation] authStatus=\(authStatus.rawValue) IDs=\(selectedAssetIDs.count) PHAsset匹配=\(fetchResult.count)") // result is: [AlbumCreation] authStatus=3 IDs=3 PHAsset匹配=3 var config = PHPickerConfiguration(photoLibrary: .shared()) config.preselectedAssetIdentifiers = selectedAssetIDs config.selectionLimit = 0 let picker = PHPickerViewController(configuration: config) picker.delegate = self present(picker, animated: true)
Replies
1
Boosts
0
Views
428
Activity
May ’26
PHPhotosErrorDomain Code: 3302 started affecting my users recently.
Recently I received multiple user email supports because the app cannot save video to photos, they are all on iOS 26.x The code in my app around recording video and saving to Photos hasn't changed in years. I'm not able to reproduce it locally, I tried on all my available devices. In recently published build I added additional logs and it appears that all of cases that fail with 3302 have the photos access set to "Limited Access". It never happens to users with "Full Access". In that build I also added a fallback, when saving to photos fails, the app saves to Documents and it seems it works (two of my users affected users confirmed it), but it's very unfortunate. I think it kind of proves that videos aren't broken given that users are able to play them just fine. On of users says that for him saving to Photos works for 2-3 times after he reinstalls the app and then it stops working. Did anything recently changed in how we should save videos to photos? I'm using the following code. I can see in git blame that I haven't changed in since 2020 and never encountered those errors in development or heard about those issues until around 1 month ago. Thank you. PHPhotoLibrary.shared().performChanges { PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: fileURL) } completionHandler: { success, error in
Replies
2
Boosts
0
Views
686
Activity
Apr ’26