App becomes unresponsive when calling Application.quit() while there are no internet connected

I have a problem about quitting app by Application.quit() when internet is down
To resolve the re-connecting issues of Photon Client when it disconnecting from server, i called the Connect method in OnDisconnected and DebugReturn


public void DebugReturn(DebugLevel level, string message)
{
if (level == ExitGames.Client.Photon.DebugLevel.ERROR)
{
Debug.LogError(message);
StartConnect();
}
else if (level == ExitGames.Client.Photon.DebugLevel.WARNING)
{
Debug.LogWarning(message);
}
else
{
Debug.Log(message);
}
}

public void OnDisconnected()
{
view.Hide();
Debug.Log("OnDisconnected");
firstTime = false;
if(reconnect){
StartConnect();
}
}

This work as fine as expected.
Using the OnApplicationQuit() that suggested in demo everything is normal.
This

public void OnApplicationQuit()
{
if (this.chatClient != null)
{
this.chatClient.Disconnect();
}
}

But after i force disconnecting my iPhone from internet (Turn off wifi,...) calling Application.Quit() the app become unresponsive and hold there forever until i have to manually kill the app
FYI: Application.Quit() work on android but not on my iphone.
I regconized that using the Connect inside DebugReturn and OnDisconnected cause this issues. How do i handling this if i want to reconnect every time chat client is disconnect?
Sign In or Register to comment.