I don't know what could be wrong but my UNNotificationServiceExtension is never getting called by any push from FCM. I call the FCM from a Python3 script and so far it works (I get a push notification but always with the default text and not the modified one).
My Extension is also pretty basic (for testing) and I already tried to remove it and add it again to my main app project without success.
Anyone has a idea what I still can check, test or miss?
Code Block firebaseHeaders = { "Content-Type":"application/json", "Authorization":"key=MY_KEY" } firebaseBody = { "to":device_token, "priority":"high", "mutable-content":True, "apns-priority":5, "notification": { "title_loc_key":"push.goalReachedTitle", "body_loc_key":"push.goalReachedContentRemote", "body_loc_args":[str(entry['value']), entry['region']], "sound":"default", "badge":1 }, "data": { "values":data, "region":entry['region'], "value":entry['value'] } } firebaseResult = requests.post("https://fcm.googleapis.com/fcm/send", data=None, json=firebaseBody, headers=firebaseHeaders)
My Extension is also pretty basic (for testing) and I already tried to remove it and add it again to my main app project without success.
Code Block class NotificationService: UNNotificationServiceExtension { var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) if let bestAttemptContent = bestAttemptContent { bestAttemptContent.title = bestAttemptContent.title + " [TEST 123]" contentHandler(bestAttemptContent) } } override func serviceExtensionTimeWillExpire() { // Called just before the extension will be terminated by the system. // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { contentHandler(bestAttemptContent) } } }
Anyone has a idea what I still can check, test or miss?