applicationStorageDirectory files not loading on iOS
Hi All,
I'm building a game and I have a persistance manager class that manages loading/saving my players game state to the File.applicationStorageDirectory.
I am able to save my player's game to the applicationStorageDirectory, but when I try to load the game state, File.exists always returns false when I run the game on an iOS device. This issue only occurs on iOS - running on a PC is fine.
I've tried compiling with AIR3.4, 3.5 and 3.6 and all of them seem to have the same issue with iOS.
I've inspected the file system of the iOS device, and I can see that saving data to the applicationStorageDirectory is working fine.
Here's a summary of my code:
private var _gameSaveFilePath:String = "gamesave.dat";
//THIS PART WORKS//
public function save(serializableObject:ISerializable):void
{
var nativePath:String = File.applicationStorageDirectory.nativePath.toString();
var file:File = new File(nativePath + "/" + _gameSaveFilePath);
if (file.exists)
file.deleteFile();
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeObject(serializableObject);
Logger.info(this, "save", "Saved GameState to file: " + file.nativePath);
fileStream.close();
}
//THIS PART RETURNS AN EMPTY FILE ON iOS, EVEN AFTER A SUCCESSFUL SAVE //
private function getGameSaveFile():File
{
return File.applicationStorageDirectory.resolvePath(_gameSaveFilePath);
}
Can anyone please help with this issue? Why would File.applicationStorageDirectory.resolvePath fail only on iOS, when I know for sure that the file exists on the device?
