iOS photo extension finishContentEditingWithCompletionHandler: Änderungen können nicht gespeichert werden
Meine Fotoerweiterungs-App hat Zugriff auf Kamera und Fotos. Alles ist in Ordnung, aber beim Drücken vonErledig, Bild kann nicht gespeichert werden.
Code des Standard-Completion-Handlers:
- (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
ist nichtnil
,error
istnil
, also Funktion[NSData writeToURL]
war erfolgreichwritten_well
istYES
,
wenn das Debuggen Zeile für Zeile ausgeführt wird, wird nach Beendigung des Blocks eine Warnung angezeigt:
output.renderedContentURL
ist/private/var/mobile/Containers/Data/PluginKitPlugin/509C1A04-D414-4DB7-B1E6-83C47FC88BC9/tmp/blah_blah_name.JPG
Also, ich habe Berechtigungen, Debug zeigt keine Fehler, was kann ich versuchen, um die Ursache des Problems zu erkennen?