objective c - APNS in ios application -


could please tell me best practice use fetchcompletionhandler when receiving remote notification in function :

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

i saw people write code @ end of above function:

 completionhandler(uibackgroundfetchresultnewdata); 

what if write :

 completionhandler(uibackgroundfetchresultnodata); 

or happens when don't put above code?

note: using xcode7.1, objective-c, ios9.1

  • uibackgroundfetchresult.newdata - called when new content has been fetched, , application has been updated.
  • uibackgroundfetchresult.nodata - called when fetch new content went through, no content available.
  • uibackgroundfetchresult.failed - useful error handling, called when fetch unable go through.

you have call let ios know result of background fetch was. uses information schedule future background fetches.

if neglect this, future backgrund fetches may delayed os.

an example of use here.

update: consequences of not calling handler might include terminating app altogether.


Comments

Popular posts from this blog

r - how do you merge two data frames the best way? -

How to debug "expected android.widget.TextView but found java.lang.string" in Android? -

php - mySQL problems with this code? -