I want to create an xml file and read from it when the application starts, and populate it with new info during runtime. This can’t be an asset because I want to write to it.
I’m using PropertyListSerialzer given here.
It works just fine without changes in the Editor, but when I deploy to a device, I get a not yet implemented exception when the library code calls XmlDocument.LoadXml
in LoadPlistFromFile
.
Here is how I’m calling the method:
var PLIST_STRING : String = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" + \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist +
version="1.0">
";
var plist : Hashtable = new Hashtable();
var xmlFile = Application.persistentDataPath + “/” + “bnp_defaults.plist”;
if(!File.Exists(xmlFile)){
var sw : StreamWriter = new StreamWriter(xmlFile,true);
sw.Write(CHoneyLizerData.PLIST_STRING);
sw.Close();
}
if(PropertyListSerializer.LoadPlistFromFile(xmlFile, plist)){
//code…
}