Has anyone had success on saving a text file on the iPad? I’m 99% sure I’m doing this correct, and it is not working. For example, the exact same pseudo code works fine on the computer, but not on the iPhone.
import System;
import System.IO;
private var writer : System.IO.StreamWriter;
var docPath : String;
function SaveDots (nameOfClient : String, blueDots : GameObject[], yellowDots : GameObject[]) {
// Get name of the file
nameOfClient = nameOfClient + ".txt";
// Get docPath
docPath = Application.dataPath.Substring(0, Application.dataPath.Length - 4) + "Documents";
writer = new StreamWriter(docPath + "/test.txt");
writer.WriteLine("jandkjasd");
writer.Close();
}
I am compiling for iPhone OS 3.2, targe device iPhone + iPad, .Net 1.1, with no Unity networking.
Using the debugger, I get the error :
DirectoryNotFoundException: Could not find a part of the path "/var/mobile/Applications/THISISMYIPADID(I hid it for security reasons, but it's like IASDS-289232, etc.)/board.app/Documents/test.txt".
System.IO.StreamWriter..ctor (System.String path)