IPhone files are not resistant

I have an iPhone app that I wrote in C # using MonoTouch. Everything works fine, but there is something funny about the files created by my application (a small sqlite database and a temporary file). The files look exis while the application remains in memory, but the moment I reboot my phone, the files disappear (?) As a result, the application continues to forget what it does to speak.

As stated in the monotouch docs, I store the files in the "personal" folder. This works great both on the emulator and on my real phone. But, as already mentioned, the files disappear in the air if I reboot or leave the phone alone for a couple of hours (note: as long as the application works and has focus, everything is fine. It seems that iOS supports resident applications if you exit on the menu).

This is an example of how I get the path for my temporary file:

var documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal);  
return Path.Combine(documents,"tr_activeTask.dat");

I understand that each iPhone application has its own "personal" folder, which is supported by the iPhone with other things. Has anyone experienced this behavior? I can not understand the reason. Is this related to the training profile I'm using (ad-hoc testing)?

+3
source share
1

, :

BaseDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "..");
Documents = Path.Combine(BaseDir, "Documents");

"Documents" .

0

Source: https://habr.com/ru/post/1795483/


All Articles