extensão de foto iOS finishContentEditingWithCompletionHandler: Não foi possível salvar as alterações
Meu aplicativo de extensão de fotos tem acesso à Câmera e às Fotos. Está tudo bem, mas ao pressionarFeito, não pode salvar a imagem.
Código do manipulador de conclusão padrão:
- (void)finishContentEditingWithCompletionHandler:(void (^)(PHContentEditingOutput *))completionHandler {
// Update UI to reflect that editing has finished and output is being rendered.
// Render and provide output on a background queue.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
PHContentEditingOutput *output = [[PHContentEditingOutput alloc] initWithContentEditingInput:self.input];
NSError* error = nil;
NSData *renderedJPEGData = UIImageJPEGRepresentation(filtered_ui_image, 1.0);
assert(renderedJPEGData != nil);
//BOOL written_well = [renderedJPEGData writeToURL:output.renderedContentURL atomically:YES];
BOOL written_well = [renderedJPEGData writeToURL:output.renderedContentURL options:NSDataWritingAtomic error:&error];
assert(written_well);
// Call completion handler to commit edit to Photos.
completionHandler(output);
});
}
renderedJPEGData
não énil
,error
énil
, assim funcionar[NSData writeToURL]
foi bem sucedido,written_well
éYES
,
ao depurar linha por linha, após a conclusão do bloco, um alerta é exibido:
output.renderedContentURL
é/private/var/mobile/Containers/Data/PluginKitPlugin/509C1A04-D414-4DB7-B1E6-83C47FC88BC9/tmp/blah_blah_name.JPG
Então, eu tenho permissões, a depuração não mostra erros, o que posso tentar detectar a causa do problema?