unity3d - FB.Init fails when there's no internet connection in Unity Facebook SDK -
Due to the nature of my app, I will have to call FB.Init as soon as possible.
FB.Init (onInDDLEGATE); It works well all the time when there is no internet connection. In this case, on-individalegate will not be called and I will be left with the app with the hanging
I can end one time init, but I have an error callback or an alternative option. Any ideas?
Add FB init to a coronetine and wait a little bit in it, / P>
As an example:
using UnityGen; Using System.Collections; Public class example: monobahavier {attempting to personalize the connection = false; Private bool socailly connected = false; Try personal floatSocialColanEgain = 0.0F; IEnumerator WaitAndInit () {Attempting connection = true; // Make sure the level is fully loaded while i (application.isLoadingLevel ()) {} // just give it a second yield yields New WaitForSeconds (1); Try {FB.Init (onInDelegate); Socially connected = true; } Hold {debug.log ("unable to join Facebook"); TrySocialCallAgain = Time.time + 10; } To try connection = true; } Zero Start () {// StartCoroutine (WaitAndInit ()); } Late update (zero!) (If (socially connected) & amp; amp; amp; amp; amp; amp; effort; connection () (if time & gt; try social code) {StartCoroutine (WaitAndInit ());}}}} This will try to make a connection in the background, if no connection can be made, it will wait 10 seconds and try again .
Wait till the app is completely loaded and then wait for an extra seconds. Wait, not to make sure, why I added that part, I think you can remove it
Hope that helped.
Comments
Post a Comment