0
Les contrôles d'instruction suivants si le fichier au chemin d'accès existe:iPhone System.IO.File.Exists() ne fonctionne pas
string path = GetiPhoneDocumentsPath();
if (System.IO.File.Exists(path) == false) XmlTextWriter textWriter = new XmlTextWriter(path,null);
Ensuite, si le fichier n'existe pas en crée une nouvelle, tout fonctionne bien dans l'exécution de l'unité, mais quand j'exécute le programme dans iphone, le fichier n'est jamais créé.
est ici la fonction pour obtenir le chemin:
public static string GetiPhoneDocumentsPath()
{
// Your game has read+write access to /var/mobile/Applications/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Documents
// Application.dataPath returns
// /var/mobile/Applications/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/myappname.app/Data
// Strip "/Data" from path
string path = Application.dataPath.Substring(0, Application.dataPath.Length - 5);
// Strip application name
path = path.Substring(0, path.LastIndexOf('/'));
return path + "/Documents/myFile.xml";
}