Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
2
Question by Leniaal · Oct 19, 2016 at 04:55 PM · ioswwwgoogleurl

WWW Request for image error, unsupported URL

Hello, I'm trying to download a Google Static Map image to my mobile app. This is working properly on Android and Windows, unfortunately I'm getting the unsupported URL error on iOS. Here is the code;

 IEnumerator GetGoogleMapsImage()
     {
         WWW request = new WWW(WWW.EscapeURL("https://maps.googleapis.com/maps/api/staticmap?center=" + MapCenter.Latitude + "," + MapCenter.Longitude + "&zoom=15&size=1280x1280&maptype=hybrid&sensor=false&style=feature:all|element:labels|visibility:off&scale=4&key="+apikeyGoogle));
         while (!request.isDone) {
             Debug.Log ("Downloading");
             yield return 0;
         }
 
         if (request.error != null) {
             Debug.Log (request.error+": "+request.url);
         }
 
         if (request.isDone && notLoaded) {
             Debug.Log ("IMAGE!");
             Debug.Log (request.texture.height);
             mapDownloadOriginal = request.texture;
             Map.sprite = Sprite.Create (mapDownloadOriginal, new Rect (0, 0, mapDownloadOriginal.width, mapDownloadOriginal.height), new Vector2 (0.5f, 0.5f));
 
             mapBounds = MercatorProjection.GetBounds (MapCenter, 15, 640, 640);
 
             onePercentCoordinates = new Coordinates ();
             onePercentCoordinates.Latitude = (mapBounds.NorthEast.Latitude - mapBounds.SouthWest.Latitude) / 100;
             onePercentCoordinates.Longitude = (mapBounds.NorthEast.Longitude - mapBounds.SouthWest.Longitude) / 100;
 
             StartCoroutine (PlaceMarker ());
 
             StartCoroutine (PlaceMarkerBlue ());
 
             notLoaded = false;
         }
 
         yield return 0;
     }
 

Does somebody know any solution? Or maybe an alternative to get the image in my app?

Comment
Add comment
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

1 Reply

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

Answer by elenzil · Oct 19, 2016 at 05:43 PM

you might try using the newer UnityWebRequest framework instead of WWW. it's significantly more modern.

but iOS might still complain.

what's the exact results of EscapeURL ? what happens if you try to enter that URL right into safari ?

Comment
Add comment · Show 6 · 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 Leniaal · Oct 24, 2016 at 03:34 PM 1
Share

Thanks a lot mate, it works perfectly with the UnityWebRequest framework. Barely had to make any changes either. Cheers!

avatar image elenzil Leniaal · Oct 24, 2016 at 04:40 PM 0
Share

awesome. glad that worked out!

avatar image magesh_rathnam Leniaal · May 04, 2017 at 05:34 PM 0
Share

Hi Leniaal/elenzil - Am facing a similar issue with WWW, in iOS. I tried UnityWebRequest too. It says req.isDone as true, but when I try to use the texture, it gives me the error - InvalidOperationException. - which comes when Unity was unable to decode the downloaded data, or has not yet finished decompressing/decoding the downloaded data.

Here is the link to the post, where I posted this query. http://answers.unity3d.com/questions/1348908/download-texture-in-unity3d-not-working-1.html

Would you $$anonymous$$d sharing a sample code on how you got it working with UnityWebRequest? Thanks.

Appreciate your help.

avatar image flashmandv · Oct 30, 2016 at 11:34 PM 0
Share

It works for me too. In iOS WWW does not work for some URL's for some reason (when having Cyrillic characters or something. $$anonymous$$igrating to UnityWebRequest solved the problem

avatar image MihajloNen · Dec 21, 2016 at 08:36 PM 0
Share

Even if UnityWebRequest works fine, have you guys found out a solution for WWW? Or at least 'why' it does complain? I am using $$anonymous$$APNAV Plugin and it is completely shut down at the time.Even tried to configure xCodes NSAppTransportSecurity The $$anonymous$$aps never load with the WWW. I am wondering if the issue is cleared now. Got the same problem with some more URLs in the iOS build while others ins$$anonymous$$d work fine. Cheers

avatar image toddisarockstar · May 04, 2017 at 11:31 PM 0
Share

i found something interesting recently if you do this

         print ("i recieved: "+responce.text);
     
     // if there is a png or jpg in there somewhere it will tell you in the console




it also shows if there is any B.S. before the image so you can grab the bytes you need and use texture.LoadImage

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

78 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

is it possible to get the url from a webpage? 1 Answer

AssetBundle won't download on iPad 0 Answers

Video 'not supported' on iPad 1 Answer

Google VR for IOS error 0 Answers

WWW problem : URL with blank symbol not functional on iOS 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