Reputation: 134
I want to prefetch new incoming messages when Push notification arrives to improve user experience
Apple says that in background mode (UIBackgroundModes: remote-notification) we need to use NSURLSession class to make network requests.
Is it possible to use QB SDK "as is" or I need to write my own wrapper for QB's REST API?
Upvotes: 1
Views: 441
Reputation: 18346
Did you try to perform any QB requests in background?
All QB requests are asynchronous so it can be a case
Otherwise, QB SDK provides an access to the session token
[QBBaseModule sharedModule].token
so you can use it to perform requests in other way, e.g. using NSURLSession
QuickBlox does support content-available key in push messages.
The content-available property with a value of 1 lets the remote notification act as a “silent” notification. When a silent notification arrives, iOS wakes up your app in the background so that you can get new data from your server or do background information processing. Users aren’t told about the new or changed information that results from a silent notification, but they can find out about it the next time they open your app.
So it's up to developer how to react on content-available key, you can request some data from server or do nothing.
There is a special delegate application:didReceiveRemoteNotification:fetchCompletionHandler: which will be called in case of content-available key
Upvotes: 1