Search Unity

Check Internet connection

Discussion in 'iOS and tvOS' started by lordubik, May 13, 2015.

  1. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    Hi, I have created a class to check internet connection with class Ping, but on device the application doesn't works. I have a crash (see screenshots).
    The Ping class is not compatible with iOS? I have used www, but is too heavy, it generates delayed rendering.

    Thanks for help!
     

    Attached Files:

  2. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    any idea? :(
     
  3. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    We'd need to see the code that's failing.
     
  4. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    attached!

    Thanks!
     

    Attached Files:

  5. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    But is it possible use Ping on iOS?
     
  6. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    Nobody help me? :(
     
  7. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I expect your issue is that in your update() you have (pseudo code):

    Code (csharp):
    1. if(ping.isDone) {
    2.   //
    3.   // do ping stuff done
    4.   //
    5. } else {
    6.   //
    7.   // Ping failed
    8.   //
    9. }
    This makes the assumption that the ping will be complete by the first call to Update() - this is very unlikely to be the case.

    tldr; You assume the ping is failing before it's had chance to complete.
     
  8. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
  9. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
  10. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    What version of Unity are you using? There have been bugs with networking an IL2CPP that may have been fixed in later releases (if the patch release is newer than the main release try the latest patch release also).
     
  11. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    I am using Unity5.0.2f1, there is a patch for this version?
    Thanks!
     
  12. Adnan_Asif

    Adnan_Asif

    Joined:
    Aug 12, 2014
    Posts:
    1
    hello, I'm having the exact same issue with Unity 5.1.1f1,
    Can anybody please suggest any workaround.
    thank you.
     
  13. lordubik

    lordubik

    Joined:
    Feb 18, 2013
    Posts:
    149
    My workaround :(
    you can check every 5 seconds... because the test generate a lag...
    on the script you can use ping or www... on iOS works only www :(
     

    Attached Files: