Hy,
I would like to save data on the iPhone that is going to be send (at a defined time) to another device. Can I do that?
Thanks!
Hy,
I would like to save data on the iPhone that is going to be send (at a defined time) to another device. Can I do that?
Thanks!
From the unity iphone manual:
You can save required files to a Documents folder next to your game's Data folder.
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";
}
You can Cache downloaded asset bundle using .NET file API and for reuse it in the future by loading it via WWW class
// Code designed for caching on iPhone, cachedAssetBundle path must be different when running in Editor
// See code snippet above for getting the path to your Documents folder
private var cachedAssetBundle : "path to your Documents folder" + "/savedassetbundle.assetbundle";
var cache = new System.IO.FileStream(cachedAssetBundle, System.IO.FileMode.Create);
cache.Write(download.bytes, 0, download.bytes.Length);
cache.Close();
Debug.Log("Cache saved: " + cachedAssetBundle);
In short, yes you can save files on the iphone with the System.IO.FileStream
The API you want to use to get path to Documents folder of an App (where things can be persistently stored) is Application.persistentDataPath.
how can i delete saved data which i stored at persistent data path from the application ? can anyone suggest ?
Yep you can retrieve data by yourself. There are programs to do that. For example File Manager App For Iphone I used it few times.it’s free and it works as good as can be expected. The main thing is to stop using the external hard disk until you use this tool, and avoid writing any files to it.