NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
@synchronized (session)
{
[[session downloadTaskWithURL:attachmentURL
completionHandler:^(NSURL *temporaryFileLocation, NSURLResponse *response, NSError *error) {
if (error != nil) {
NSLog(@"error.localizedDescription %@", error.localizedDescription);
} else {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *localURL = [NSURL fileURLWithPath:[temporaryFileLocation.path stringByAppendingString:fileExt]];
[fileManager moveItemAtURL:temporaryFileLocation toURL:localURL error:&error];
NSError *attachmentError = nil;
attachment = [UNNotificationAttachment attachmentWithIdentifier:@"" URL:localURL options:nil error:&attachmentError];
if (attachmentError) {
NSLog(@"attachmentError.localizedDescription %@", attachmentError.localizedDescription);
}
}
completionHandler(attachment);
}] resume];
}
Ich verwende FCM für Push-Benachrichtigung.Fehler __NSCFLocalDownloadFile Fehler 2 Erstellen von Temp
{
"to": "ffHjl2CblrI...",
"data": {
"message": "Offer!",
"image": "https://media.giphy.com/media/l4lR0Q5u91kTNJPsA/giphy.gif",
"url": custom url,
"mediaType": "gif",
"type": "notification type"
},
"notification": {
"body": "Body",
"sound": "default",
"title": "Title"
},
"content_available": true,
"mutable_content": true
}
Das ist meine Nutzlast Inhalt.
Ich verwende NotificationExtension über Code, den ich verwende, um Daten von der Push-Benachrichtigung herunterzuladen.
Ich bekam eine Erfolgsantwort von Entwicklerzertifikat. Wenn ich mit der Produktion Zertifikat (mit vorherigen Update) überprüfen habe ich Fehler wie diese
__NSCFLocalDownloadFile: error 2 creating temp file: /private/var/mobile/Containers/Data/PluginKitPlugin/7D6B57B4-DC4D-4F3E-8113-C8469BA66BBB/tmp/CFNetworkDownload_NQQfGi.tmp
Wenn ich die App löschen und erneut ausführen, um es funktioniert. Aber wenn ich die Version mit einem neuen IPA aktualisiere, wird das Bild in der Benachrichtigung nicht angezeigt.
Was ich vermisse, ist dieses Zertifikat Problem? Ist das Problem mit der App-Berechtigung?
Ich verwende separate APP ID (ohne Push-Benachrichtigung Config) für UNNotificationServiceExtension
.
aktualisieren
Auch mit APNS geprüft dass auch nicht funktioniert.
Ein paar mehr Code und eine Erklärung über APNS und Nutzlast Inhalt
Richmedia notification notification not working in production certifcate
Rich push notification not work properlly after update IPA (same IPA with overwirtten)
Aber das ist Arbeit für Entwicklung Zertifikat und auch in App-Store-Zertifikat (mit Testflight). – user3589771
Ich weiß nicht, ob es auf Builds beschränkt ist oder nicht – Mousavian