Error saving image to Camera Roll on iPhone 17 Pro

I'm experiencing an issue with my app when saving images to the camera roll. This is intermittent, but it happens several times a day. The error I receive is the following:

Connection to assetsd was interrupted - assetsd exited, died, or closed the photo library
Error getting remote object proxy for -[PLNonBindingAssetsdPhotoKitClient sendChangesRequest:reply:]_block_invoke: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.photos.service" UserInfo={NSDebugDescription=connection to service named com.apple.photos.service}
PhotoKit XPC proxy is invalid. Dropping request on the floor and returning an error: Error Domain=PHPhotosErrorDomain Code=3301 "(null)" (underlying error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.photos.service" UserInfo={NSDebugDescription=connection to service named com.apple.photos.service})
CoreData: error: XPC: synchronousRemoteObjectProxyWithErrorHandler: store 'file:///var/mobile/Media/PhotoData/Photos.sqlite' encountered error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.}
CoreData: error: XPC: synchronousRemoteObjectProxyWithErrorHandler: store 'file:///var/mobile/Media/PhotoData/Photos.sqlite' encountered error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003." UserInfo={NSDebugDescription=The connection to service created from an endpoint was invalidated: failed to check-in, peer may have been unloaded: mach_error=10000003.}

My code is unchanged from using my app daily on an iPhone 16 Pro with iOS 26. I never saw the issue on this device.

Here is an excerpt from my code for saving the image:

        var localIdentifier = String()
      PHPhotoLibrary.shared().performChanges({
          let albumChangeRequest = PHAssetCollectionChangeRequest(for: album)
          let assetCreationRequest = PHAssetCreationRequest.forAsset()
        
          let options = PHAssetResourceCreationOptions()
          assetCreationRequest.addResource(with: .photo, data: imageData, options: options)
          assetCreationRequest.creationDate = Date.now
          
          let placeHolder = assetCreationRequest.placeholderForCreatedAsset
          albumChangeRequest?.addAssets([placeHolder!] as NSArray)
          if placeHolder != nil {
              localIdentifier = (placeHolder?.localIdentifier)!
          }
      }) { (didSucceed, error) in
          OperationQueue.main.addOperation({
              didSucceed ? success(localIdentifier) : failure(error)
          })
      }

I'm not sure why this would be device specific but I have had users with iPhone 17 Pro and iPhone Air reporting the issue.

Alex

Error saving image to Camera Roll on iPhone 17 Pro
 
 
Q