PDA

View Full Version : Don't drop TCP connection when I...



Noah David
06-07-2012, 06:48 PM
Please can we not drop my connection to the game whenever the following happens in iOS?

1. Opening the Multi-tasking Bar.
2. Pulling down the Notification Window.
3. Receiving a "Battery at 20%" popup box.

Thanks!

zarkwizard
06-07-2012, 07:03 PM
It's not me dropping the connection. Apple cuts the connection. If the game drops it's because apple has suspended the application which causes the connection to be cut.

Balian
06-07-2012, 07:27 PM
The only time connection failure ever poses more than a extremely minor inconvenience is went I am typing large mails, so I just type them in notes and copy/paste them over, problem solved. : D

Noah David
06-07-2012, 07:51 PM
The only time connection failure ever poses more than a extremely minor inconvenience is went I am typing large mails, so I just type them in notes and copy/paste them over, problem solved. : DOh yeah, that happened to me the other day. Was super annoying...

But can't you just register the app as a VoIP application and use the setKeepAliveTimeout method to maintain your TCP connection for up to 10 minutes? http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf

Or you could even use the beginBackgroundTaskWithExpirationHandler method to ensure the connection is not dropped.

Something like this?



UIBackgroundTaskIdentifier hangTight;
hangTight = [[UIApplicationsharedApplication]
beginBackgroundTaskWithExpirationHandler:^{
/* if you exceed 10 minutes */
}];
[[UIApplication sharedApplication] endBackgroundTask:hangTight];

Noah David
06-14-2012, 05:21 PM
Well? Have you looked into this tactic?