I have an iOS messaging app with custom notification actions (buttons that are shown when the notification is expanded on iOS 10+). Some actions need to trigger a REST call to my server without launching the app UI (UNNotificationActionOptions.foreground
is omitted in options). Naturally the REST call may fail, but I have no GUI to reflect this to the user. What are the best practices of handling errors in such situation?
Options I could think of:
- Show a local notification detailing the error.
- Retry with exponential backoff in background mode.
- Record the error and show an alert the next time the app is launched.
- Use
UNNotificationActionOptions.foreground
after all and show an alert.
None of these seem good to me, so I wanted to ask if anyone has come with a better solution. This seems to be a common issue in messaging apps.