iOS notification custom actions (buttons) -- best practices of handling errors when no GUI

91 views Asked by At

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:

  1. Show a local notification detailing the error.
  2. Retry with exponential backoff in background mode.
  3. Record the error and show an alert the next time the app is launched.
  4. 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.

0

There are 0 answers