ファイルの読み書きに以下のコードを使用しました。iOSのファイル読み書きエラー
private void StorePuzzleData()
{
FileInfo fileInfo = new FileInfo (Application.persistentDataPath + "\\" + difficultyLevel + puzzleId + ".txt");
if (fileInfo.Exists)
fileInfo.Delete();
string fileData = string.Empty;
foreach (CellInformation cellInfo in cellInfoList)
fileData += cellInfo.RowIndex + "#" + cellInfo.ColIndex + "#" + cellInfo.number + "#" + cellInfo.CellColor + "#" + cellInfo.CellDisplayColor + "#" + (cellInfo.IsGroupComplete ? 1 : 0) + ",";
StreamWriter streamWriter = fileInfo.CreateText();
streamWriter.WriteLine (fileData);
streamWriter.Close();
DataStorage.StorePuzzleTimePassed (difficultyLevel, puzzleId, GameController.gamePlayTime);
}
private void ReadPuzzleData()
{
// format: rownumber, colnumber, number, cellcolor, celldisplaycolor, isgroupcomplete
StreamReader streamReader = File.OpenText (Application.persistentDataPath + "\\" + difficultyLevel + puzzleId + ".txt");
string fileData = streamReader.ReadLine();
}
実際のiOSデバイスの実行中に次のエラーが発生しています。このコードは、アンドロイドデバイスでも同様にiMacで正しく動作します。
私がこれが正しい作るために何をする必要があるかの変更いくつかの提案をお願いします。
あなたのパスの最後のスラッシュはバックスラッシュで、他のすべては前方スラッシュですが、コードのどこでも "\\"の代わりに "//"を使用してみてください –
その後、Windowsでクラッシュします:) –