- Home /
Reading/Loading xml files on iPad 2
I am using a modified version of XML Serializer from this website: http://wiki.unity3d.com/index.php?title=Saving_and_Loading_Data:_XmlSerializer
I tried on my Mac and UnityEditor and it working perfectly. However when I deployed my app onto the iPad 2, It crashes whenever I try to access the XML contents.
I load my XML file on the Start() and I got this error/warning on my Xcode console:
UnauthorizedAccessException: Access to the path "/var/mobile/Applications/ADD2A1E3-C95B-4727-8D38-14D781906719/toteboard.app/Data/crocodileCollection.xml" is denied. at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in :0 at System.IO.FileStream..ctor (System.String path, FileMode mode) [0x00000] in :0 at CrocodileContainer.Load (System.String pathName) [0x00000] in :0 at CrocodileManager.Start () [0x00000] in :0
I use various methods to solve this issue but none of them work. Including StreamingAssets folder, modify the pathname, etc. I guess I'm really stuck here. Anyone please provide me some advices on this. Thank you
Tool version: Unity3D Pro 3.5.5f, Xcode 4.4.2
Is the open mode just File.Open? I'm wondering if it's because it thinks you are trying to write it (which is only possible in Application.persistentDataPath).
You are right in thinking you should put it in Strea$$anonymous$$gAssets - your other choice would be to make it a TextAsset in resources and then get the text from that.
Thank you for replying..
To be honest, I don't really understand what is this problem. What does it mean that "Access to the path "..." is denied." Why is it denied? I believed the path name is correct, if not, I'll be getting another error which is something like "Directory not found: blah blah".
As for the File IO, I trying to find out whether by opening the file, will I accidentally modified the content or whatsoever. I will worked on that, Thank you.
Access denied means that you cannot access the file due to some restriction - for example you are writing to a read only file or location.