9

I have enabled NotificationServiceExtension in my app. And done the following

  1. Added .apppex under Frameworks, Libraries and Embedded contents
  2. Confirmed both deployment target version is 12.0
  3. Sending mutable-content": 1 in my apns notification payload
  4. Following is my NotificationService's didReceiveNotificationRequest method

    - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    
    self.bestAttemptContent = [request.content mutableCopy];
    
    self.bestAttemptContent.badge = @20;
    self.contentHandler(self.bestAttemptContent);
    

    }

Don't know what I am missing here. Searched and followed so many documents. Nothing seems to be working.

I am using XCode 11.2.1 and real device with ios version 13.

Beu
  • 1,370
  • 10
  • 23
  • Did you check bundle id's as well? Extension's bundle id should be prefixed with the app's bundle id, like: app: `test.sample.app`, extension: `test.sample.app.extension` – BoygeniusDexter May 19 '20 at 14:41
  • yes. Thats looks good. my app bundle id com.testcompany.appname Extension bundle id: com.testcompany.appname. – Beu May 19 '20 at 14:46
  • Do I need to add app group? – Beu May 19 '20 at 15:10
  • no, app group is not needed. the only difference I see is according to documentation `"mutable-content"` has to be set to `true` and not `1` – BoygeniusDexter May 19 '20 at 15:17
  • Tried that too. Not working :( – Beu May 20 '20 at 03:56
  • How do you know that it's not launching the service extension? See [here](https://stackoverflow.com/questions/48507016/how-to-debug-an-ios-app-extension/62200031#62200031) and [here](https://stackoverflow.com/questions/49511005/cant-attach-debugger-to-unnotificationserviceextension/62395161#62395161) – mfaani Jun 24 '20 at 02:08

0 Answers0