• 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 SimonW · Jun 22, 2012 at 01:31 PM · iosnetworkingwww

WWW class is empty on iOS

I have some networking code using Unity's WWW class that reads data from a remote server. It works fine in the editor, but when I try it from an iPad the www object is completely empty - no headers, no error, nothing. Here's a stripped down version of what I'm doing:

 WWW www;
 
 public void StartLogin (string username, string password)
 {    
     WWWForm form = new WWWForm();
     form.AddField("username", username);
     
     Hashtable headers = form.headers;
     
     headers["username"] = username;
     headers["password"] = password;
     headers["deviceId"] = 2; 
     
     www = new WWW(loginUrl, form.data, headers);
     //StartCoroutine(WaitForLoginRequest());        
 }
 
 void Update()
 {
     if (www != null && www.isDone)
     {
         DoLoginRequest();
     }
 }
 
 void DoLoginRequest()
 {
         //Code goes here

         www = null;
 }

As you can see, I started using coroutines, but switched over to a simpler version using Update (didn't help). I know the connection is getting through to the server because it's logging an error 412 - I can fix that, but I'm more worried about where all my information is going on the iOS side.

Comment
Add comment · Show 1
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 SimonW · Jun 23, 2012 at 02:19 PM 0
Share

Update - I realised that the response text was supposed to be empty. So the big question becomes "do response headers work on iOS"?

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by SimonW · Jun 27, 2012 at 09:46 PM

And the answer is no, response headers seem to be completely broken on iOS. If anyone else hits this problem, I suggest not using them.

Comment
Add comment · Show 1 · 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
avatar image hammad-zahid · Jan 14, 2016 at 07:24 AM 1
Share

Sir did you got solution? plz help. i am also get stuck in it...

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

[iOS] WWW class sometimes doesn't return a response 0 Answers

Memory leak with WWW on iOS 1 Answer

WWW class http error handling 0 Answers

Networking from iPad to PC 1 Answer

HttpWebResponse and JIT on iOS 2 Answers


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