Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

WWW request works in Windows but not Mac

Discussion in 'Scripting' started by shaun, May 7, 2007.

  1. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    I have a login script that uses the WWW class to query an ASPX script, which works great in the Windows Web Player but fails in Mac - it just doesnt return any data.

    I have no idea why the same .unityweb file would work in Win and not Mac - unless im using something specific to Windows, which im sure im not.

    Cheers
    Shaun
     
  2. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    This is a longshot, but any change there is an issue with your browser and your server? Maybe not playing nice with each other?

    Can you post some of your code?

    EDIT: Does it work fine on mac standalone? And have you tried clearing your browser cache?

    -Jeremy
     
  3. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    good points

    just quickly - mac standalone is fine, as is PC standalone

    the code is really simple
    Code (csharp):
    1.  
    2.     IEnumerator fncGetXMLData(){
    3.     string strURLXML = "http://www.someserver.com/blah/default.aspx?DoFunction=fncGetMemberContactList&AccessToken=1012-ckcmzf55huwimmzsjhloxb45-20075574350-11510497117110108115";
    4.     WWW loginRequest = new WWW(strURLXML);
    5.     XmlDocument doc = new XmlDocument();
    6.  
    7.  
    8.    
    9.     yield return loginRequest;
    10.    
    11.         doc.LoadXml(loginRequest.data);
    12.         XmlNode root = doc.FirstChild;
    13.         Debug.Log(root["Table"].InnerXml);
    14. }
    15.  
    even without the xml stuff it still fails
     
  4. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Have you tried Debug.Log(www.error); to see if it tells what's going on?

    -Jon
     
  5. mikemittelman

    mikemittelman

    Joined:
    May 12, 2007
    Posts:
    6
    Check the length of the string you are getting back. There is a low level mono bug that sometimes doesn't wait for all the data to be returned.
     
  6. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Really? Wow, do you know how to work around it?

    -Jon
     
  7. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Thats not the case.
     
  8. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    Ive been doing some more testing and have found the following:

    From the web player - it works consistently on PC and seems to always return the same data. But on Mac, it is inconsistent - it seems to be something in the WWW class. The first time i try to request the data, it fails, but the second time it works. This is sending exactly the same data to the server. strange...


    Cheers
    Shaun
     
  9. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    Long shot, the return data, is it truncated?
     
  10. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    Does the data returned from the server contain any non UTF-8 characters by any chance? In that case you will have to use WWW.bytes to access the result.
     
  11. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    If that was the case, I would think it wouldn't work on either windows or mac? But here it works on windows.

    -Jeremy
     
  12. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    I'm curious how it's failing. Is there an error, or is the data just not there? If there's an error, what is it?

    Cheers,
    -Jon
     
  13. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    @Keli - It returns a mix of Unicode and Ascii data in an XML format. Im using the .data method to return the server response which could be causing the problem.

    I just created a debug text to output the result of the query.... but now its not failing :? will try again later and post the results (it was definitely doing strange things before, honest!)

    :D
    Cheers
    Shaun