iOS photo extension finishContentEditingWithCompletionHandler: Unable to Save Changes

前端 未结 2 1891
猫巷女王i
猫巷女王i 2021-02-08 18:28

My photo extension app has access to both Camera and Photos. All is ok, but when pressing Done, it can not save image.

Code of standard completion handl

2条回答
  •  误落风尘
    2021-02-08 18:45

    Even though the header implies that adjustmentData can be nil, the documentation states:

    If you write new asset content to the URL specified by the renderedContentURL property, you must also provide a new, distinct PHAdjustmentData object describing your edit. Passing a preexisting adjustment data object (that describes an earlier edit) results in undefined behavior.

    So do something like this before calling the completion handler:

    output.adjustmentData = [[PHAdjustmentData alloc] initWithFormatIdentifier:@"com.whatever.app" formatVersion:@"1.0" data:[NSData data]];
    

提交回复
热议问题