The name says it all. I looked through this question , and also here on the pubnub forums (same question, just a different suggestion).
The core of the problem is that, as soon as the application is paused, the pubnub connection is queued and not sent until the application returns to the forefront. It seems wise to do to send a notification that you are going in the background on your channel, but it does not work.
From my readings, I understand that pubnub uses websockets and that it is not allowed in the background. Even tried to turn on VOIP as a background mode with no luck, but location update works in bg mode. However, when using this application, my application will be rejected because I do not use location services.
When running this code
- (void)applicationDidEnterBackground:(UIApplication *)application {
[PubNub sendMessage:@"Hello from PubNub iOS!" toChannel:self.myChannel;
}
I get this log entry from pubnub (so at least I know the command is running):
Looks like the client suspended"; Fix suggestion="Make sure that your application is configured to run persistently in background
I killed myself for it during the day. One of these days, when you start to do something that you think is quite simple, 15 minutes, and it turns into a day of disappointment ... You know what I mean :)
source
share