GuybrushThreepwood
GuybrushThreepwood

Reputation: 5616

UNNotificationServiceExtension - iOS10 - What Happens if the Service Crashes?

Can anybody clarify for me the way in which a push service making use of the UNNotificationServiceExtension class behaves if the service is stopped due to a crash ? When would the service be expected to restart (if at all ?).

https://developer.apple.com/reference/usernotifications/unnotificationserviceextension

Upvotes: 0

Views: 544

Answers (1)

Freed Ahmad
Freed Ahmad

Reputation: 102

As mentioned in the Apple documentation, UNNotificationServiceExtension is mainly meant to modify the content of Remote Notifications.

The system runs this extension for a limited time as soon as it receives a remote notification for your application.

During which, by adding your custom logic, you can edit title, subtitle, body, badge etc of notification before it is presented to the user.

During this process (after remote notification is received and before it is presented to the user), if UNNotificationServiceExtension crashes for whatever reason

  1. It will not stop the Notification to be shown to the user.
  2. The unaltered push notification will be presented to the user.
  3. The service does not automatically restart (unless another remote notification is received).

In short, a crash in UNNotificationServiceExtension simply leaves the related remote notification unchanged.

Upvotes: 1

Related Questions