localnotification - iOS:Issue with Silent Push triggering Local Notification -


in app using daily silent push trigger calculations inside app , based on calculation result triggering local notification.

say example: daily goal.

once silent notification reaches app, trigger background method calculate user data , compare whether his/ data achieved goal , if yes trigger local notification user can open app , check.

it not working consistently, , don't. when debugged, saw execution paused in between , execution gets resumed if user opens app again or trigger silent push again. not sure why background execution (the calculation) gets paused, , if trigger push or if manually try open app, can see breakpoint appearing , continues place paused.

i wondering whether because of time limit??

update:

i using urbanairshipsdk , have handlers overridden , using below method handle notification. written in appdelegate , gets called when notification when app in background.

/**  * called when push notification received while app running in background  * applications "remote-notification" background mode.    * overridden receivedbackgroundnotification:fetchcompletionhandler.  *  * @param notification notification dictionary.  */ - (void)receivedbackgroundnotification:(nsdictionary *)notification; 

i first check content-available in payload , treat silent , calculations. works fine intermittently not consistently. closing towards release dates , worried.

i assume use:

- (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo fetchcompletionhandler:(void (^)(uibackgroundfetchresult result))handler 

in case should not forget call completion handler , according apple docs have 30 seconds so:

as finish processing notification, must call block in handler parameter or app terminated. app has 30 seconds of wall-clock time process notification , call specified completion handler block. in practice, should call handler block done processing notification. system tracks elapsed time, power usage, , data costs app’s background downloads. apps use significant amounts of power when processing remote notifications may not woken process future notifications.


Comments