- Home /
Keep network connection from interrupting on iOS multitasking switch
Hi,
I'm using RPC calls to update game objects between client and server. I want this to continue to happen even though the user used iOS multitasking to switch to another app.
I found this thread for starting pointers.
By default, in AppController.mm applicationWillResignActive
is called which in turn invokes UnityPause(true)
which ultimately causes the network connection to drop. I have to reestablish the connection to the server when the app regains focus.
I commented out the pausing and this will keep the networking from dropping but it ceases to transmit networking data. I guess this is because of the RPC calls being hooked to the run loop. I'm using Update()
for the RPC calls which is called once per rendered frame. Is there a method in MonoBehaviour that is called even though nothing is rendered, which I could use for RPC instead?
Answer by fholm · Jan 22, 2013 at 08:02 AM
In short: What you want to do is not possible, when you switch to another app on iOS the old running app gets put into a some sort of sleep mode. You can't maintain a network connection when this happens. You need to re-establish the network connection when the app starts again.
Your answer
Follow this Question
Related Questions
Send a Pause RPC on OnApplicationPause 1 Answer
Unity 5.0.2 iOS IL2CPP Networking RPC Issues 1 Answer
iOS IL2CPP Networking Issues Unity 5.0.x 3 Answers
Background Networking Activity and Unity Run Loop 0 Answers
Networking from iPad to PC 1 Answer