Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Guliz · Apr 23, 2014 at 06:24 PM · ioscoroutinewwwwww class

Ios problem with www class

enter code herehey there I wanted to get a xml file from a webserver. It worked perfect for android and pc, but I can't get the connection on ios. I think ios got problems with the www class, but I also think its possible and I've got a mistake in the coroutine. Please have a look at my code, maybe youre able to help me:

Debug.Log("ERROR: " + www.error) shows me "ERROR: ".

crossdomin.xml is on the server

 void Start(){
    StartCoroutine(StartLoading());
 }
 
 IEnumerator StartLoading(){
    string url = "http://www.pixcube.com/games_ad/AppData.xml";
    WWW www = new WWW(url);
    while(!www.isDone)
       yield return null;

    if (www.error == null){
       XmlDocument xmlDoc = new XmlDocument();
       xmlDoc.LoadXml(www.data);
       ProcessAppLinks(xmlDoc.SelectNodes("AppLinks/AppLink"));
    }else{
       Debug.Log("ERROR: " + www.error);
    }    
 }
 
 private void ProcessAppLinks(XmlNodeList nodes){
    foreach (XmlNode node in nodes){
       //get all infos out of the xml node
       StartCoroutine(DownloadImage(nodeWithImageWebLink));
    }
 }
 
 IEnumerator DownloadImage(string url){
    WWW www = new WWW(url);
    while(!www.isDone)
       yield return null;
         
    imageArray.Add(www.texture);
 
 }
Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Graham-Dunnett ♦♦ · Apr 23, 2014 at 08:17 PM 0
Share

What does "I can't get the connection" mean?

avatar image Guliz · Apr 24, 2014 at 06:50 AM 0
Share

Hi Graham; means it won't load the xml. I think the www is returning an error but I'm not sure: Is it possible to Debug.Log trough Xcode at this point while iPad is connected?

avatar image fafase · Apr 24, 2014 at 06:54 AM 0
Share

You can print something via GUI, at least you see it right on.

avatar image Guliz · Apr 24, 2014 at 11:10 AM 0
Share

Thx for the tip fafase with the GUI. After the first www call I trace out ("ERROR: " + www.error); and it gives me "ERROR: " out. I tested it on iPad and iPhone, same results. It works on Android. $$anonymous$$aybe I've got some wrong export settings:

alt text

bildschirmfoto 2014-04-24 um 13.11.35.png (51.6 kB)
avatar image fafase · Apr 24, 2014 at 12:53 PM 0
Share

I think it only gives "ERROR:" because the object holding the error string is destroyed at the end of the StartLoading method. You could try to store the string into a global string:

 string message = null;
 IEnumerator StartLoading(){
    string url = "http://www.pixcube.com/games_ad/AppData.xml";
    WWW www = new WWW(url);
    while(!www.isDone)
       yield return null;
  
    if (www.error == null){
       XmlDocument xmlDoc = new XmlDocument();
       xmlDoc.LoadXml(www.data);
       ProcessAppLinks(xmlDoc.SelectNodes("AppLinks/AppLink"));
    }else{
       message = www.error;
    }    
 }
 void OnGUI(){
     GUI.Box(rect, message);
 }
Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MihajloNen · Dec 21, 2016 at 08:38 PM

I have the same Issues, but not with all WWW requests. I even tried to configure xCodes NSAppTransportSecurity to allow http downloads. Nothing helped. If smo. know a better solution pls help. Thank's

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sending to API special french characters 0 Answers

WWW yield is not returning any value in ios for yahoo finance api 2 Answers

unity3d www download of large texture mobile 0 Answers

WWW class downloading image doesn't work in Web Player? 1 Answer

WWW in iOS does not set user agent header 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges