iOS photo extension finishContentEditingWithCompletionHandler: Unable to Save Changes

前端 未结 2 1899
猫巷女王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 19:04

    As of iOS 10, the adjustment data must have at least one byte. This is a breaking change from iOS 9, where the adjustment data can be nil. I've tested this on both iOS 9 and iOS 10 to confirm.

    Additional documentation: https://developer.apple.com/reference/photos/phcontenteditingoutput/1518684-adjustmentdata

    PHContentEditingOutput* output = [[PHContentEditingOutput alloc] initWithContentEditingInput:self.input];
    NSMutableData* adjustmentData = [NSMutableData data];
    uint8_t byte = 1;
    [adjustmentData appendBytes:&byte length:1];
    output.adjustmentData = [[PHAdjustmentData alloc] initWithFormatIdentifier:@"com.yourcompany.yourapp" formatVersion:@"1.0f" data:adjustmentData];
    

提交回复
热议问题