Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Load Xml from StreamingAssets on Start for iOs mobile device

$
0
0
Hello, Can't find any good source to solve my problem. On my mac I can load and save to the xml file in StreamingAssets folder. But when I build the file is unauthorized. I can make a new one and start from there but I would like to load in data from the xml file when the app first starts. CODE: void Start () { //DESKTOP if(SystemInfo.deviceType == DeviceType.Desktop){ XmlSerializer serializer = new XmlSerializer(typeof(ItemDatabase)); FileStream stream = new FileStream (Application.dataPath + "/StreamingAssets/Xml/item_data.xml", FileMode.Open); itemDB = serializer.Deserialize (stream) as ItemDatabase; stream.Close (); } //HANDHELD else if(SystemInfo.deviceType == DeviceType.Handheld){ XmlSerializer serializer = new XmlSerializer(typeof(ItemDatabase)); FileStream stream = new FileStream (Application.dataPath + "/Raw/Xml/item_data.xml", FileMode.Open); itemDB = serializer.Deserialize (stream) as ItemDatabase; stream.Close (); } ERROR in Xcode: UnauthorizedAccessException: Access to the path "/var/containers/Bundle/Application/1A86B856-950E-4501-A033-4E202BF0AF02/test.app/Data/Raw/Xml/item_data.xml" is denied

Viewing all articles
Browse latest Browse all 4709

Trending Articles



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