简体   繁体   中英

Calling web service for the notification action for a remote push notification on iOS

I need to call 2 web service calls when user clicks on a button on the interactive notification. This notification is a remote push notification. The web service calls work fine when the application is in foreground or background. But the behavior is not consistent when the app is in suspended state (user forcefully killed the app). Some times it works well ie, calls both the web service calls. some times it fails and the most common reason I have seen in the logs is

Application background launch action for notification response action vscd.escalate received action response { description = "The operation couldn't be completed. (BSActionErrorDomain error 4.)"; }>

I have only " Remote notifications " enabled under capabilities. " Background fetch " is not enabled.

Any help is appreciated.

I had this happen when I hadn't registered the notification delegate properly on app launch - just like they warn in the documentation. The fix was to ensure the delegate was set explicitly during didFinishLaunchingWithOptions .

Previously, my app set the delegate during load of the initial view controller, which works for every case except when the app is not running in the foreground or the background, but is launched by the notification itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM