I've start editing an image in Photos on macOS with my extension, and then when I try to save, I get an alert saying something went wrong when saving.
In the finish content editing method I save my photo async like this:
I see the success print, tho I still get an popup alert saying it failed in Photos and no edits gets saved.
Do anyone know how to debug this?
Code Block func finishContentEditing(completionHandler:)
In the finish content editing method I save my photo async like this:
Code Block let output = PHContentEditingOutput(contentEditingInput: input) let unitCrop: UnitCrop = UnitCrop(frame: self.cropper.frame) do { let data: Data = try JSONEncoder().encode(unitCrop) output.adjustmentData = PHAdjustmentData(formatIdentifier: UnitCrop.formatIdentifier, formatVersion: UnitCrop.formatVersion, data: data) } catch { completionHandler(nil) return } self.cropper.save { result in switch result { case .success(let image): guard let imageData: Data = image.pngData() else { completionHandler(nil) return } do { try imageData.write(to: output.renderedContentURL, options: .atomic) print("success!") completionHandler(output) } catch { completionHandler(nil) return } case .failure(let error): completionHandler(nil) } }
I see the success print, tho I still get an popup alert saying it failed in Photos and no edits gets saved.
Do anyone know how to debug this?