IBM Support

APNs notification does not trigger Worklight callback function in an iOS application

Troubleshooting


Problem

When an iOS application is running in the background and receives an APNs notification, the callback function registered with Worklight is not executed. In Worklight you have the option to register a callback function that executes after an notification is received by the application.  However, if this callback function uses graphical elements like an 'alert view' this can cause a race condition to occur because the application view is not yet loaded when it tries to execute.  The results is that the app crashes or freezes.  This only happens if the application happens to be running in the background when the notification is received. 

Resolving The Problem

To work around this problem, use a WorkLight or Cordova API.  For example, instead of alert, use navigator.notification.alert API. 

This issue is resolved in V5.0.0 Fix Pack 3.

[{"Product":{"code":"SSZH4A","label":"IBM Worklight"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Notifications","Platform":[{"code":"PF014","label":"iOS"}],"Version":"5.0","Edition":"Consumer;Enterprise","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS4HGH","label":"IBM Mobile Foundation"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Server","Platform":[{"code":"","label":"Apple iOS"}],"Version":"5.0","Edition":"Consumer;Enterprise","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
17 June 2018

UID

swg21599907