I need to read, edit and save one xml file. In other words, I want to write again over the same file and not to create a new xml file. Reading and editing parts work, but not the saving.
The Linq-to-Xml code for saving is simply:
doc.Save(this.Path);
This works in iPhone Simulator but throws System.UnauthorizedAccessException on the device. The xml file is decorated as “content” in MonoDevelop.
Any help appreciated.
/pom
You need to save the file into one of the locations that you have write permissions on:
The /Document directory can be retrieved using:
var documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
Our “How To Store Files” page has more details:
http://wiki.monotouch.net/HowTo/Files/HowTo:_Store_Files