开发者

iPhone files not persistent

I have an iPhone app I have written in C# using MonoTouch. Everything works fine, but there is something funny going on with the files created by my application (a small sqLite database and a temp file). The files seem to exis while the app is resident in memory, but the moment i re-boot my phone, the files are gone (?) As a result the app keeps forgetting what it's doing so to speak.

As adviced in the monotouch docs, I store my files under the "personal" folder. This works fine both on the emulator and my real phone. But as mentioned, the files vanish into thin air if i re-boot or leave the phone alone for a couple of hours (note: as long as the app is running and has focus, everything is ok. iOS seems to keep apps resident even if you exit to the menu).

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

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

I realize that each iPhone app has it's own "personal" folder, which is backed up by iPhone amoung other things. Have anyone experienced this behavior? I cant figure out the cause. Is it somehow connected to the provisioning profile i use (ad-hoc开发者_运维知识库 testing)?


I just looked at my app, and I have this:

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

This Documents folder is where I store everything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜