Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

WWW error on ios

$
0
0
Hi Recently I'm testing my project and find it always return bad url(www.error) when attempt to load file from local disk on ios simulator. But in editor, it works fine. Here's a sample, it fail on simulator, but i can find this file from terminal, so the path is correct. Maybe we can't use "file://" in ios? void Start () { Write (); StartCoroutine (Read ("file://" + Application.persistentDataPath + "/a.txt")); } void Write () { File.WriteAllText (Application.persistentDataPath + "/a.txt", "Hello world"); } IEnumerator Read (string path) { NGUIDebug.Log ("Reading: " + path); WWW www = new WWW (path); yield return www; if (www.isDone && www.error == null) { NGUIDebug.Log ("WWW result:" + www.text); } else { NGUIDebug.Log ("WWW error:" + www.error); } } ![alt text][1] [1]: /storage/temp/15164-shot.png

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>