In my app I am using a daily silent push to trigger some calculations inside my app and based on the calculation result I am triggering a local notification.
Say for example: A daily goal.
Once the silent notification reaches my app, I trigger a background method to calculate the user data and compare whether his/ her data achieved a goal and if yes I trigger a local notification so that user can open the app and check.
It is not working consistently, sometimes I get it and sometimes don't. When I debugged, what I saw was that the execution get paused in between and execution gets resumed only if the user opens the app again or I trigger a silent push again. Not sure why the background execution (the calculation) gets paused, and if I trigger a push or if i manually try to open the app, I can see the breakpoint appearing back and it continues from the place it was paused.
I am wondering whether it is because of some time limit??
UPDATE:
I am using UrbanAirshipSDK and they have some handlers overridden and I am using the below method to handle the notification. This is written in the appdelegate and gets called when I get a notification when app is in background.
/**
* Called when a push notification is received while the app is running in the background
* for applications with the "remote-notification" background mode.
* Overridden by receivedBackgroundNotification:fetchCompletionHandler.
*
* @param notification The notification dictionary.
*/
- (void)receivedBackgroundNotification:(NSDictionary *)notification;
I first check for content-available in the payload and treat as silent and do the calculations. This works fine intermittently but not consistently. I am closing towards release dates and I really worried.