La mia app di estensione foto ha accesso sia alla fotocamera che alle foto. Tutto è ok, ma quando si preme Fine, non è possibile salvare l'immagine.Estensione foto iOS finishContentEditingWithCompletionHandler: impossibile salvare le modifiche
codice di gestore di completamento di serie:
- (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
non è nil
,
error
è nil
, così la funzione [NSData writeToURL]
ha avuto successo,
written_well
è YES
,
durante il debug per linea linea, al termine del blocco, viene visualizzato un avviso:
output.renderedContentURL
è /private/var/mobile/Containers/Data/PluginKitPlugin/509C1A04-D414-4DB7-B1E6-83C47FC88BC9/tmp/blah_blah_name.JPG
Così, ho i permessi, il debug mostra nessun errore, cosa posso cercare di individuare la causa del problema?