简体   繁体   中英

Xamarin Forms PCLStorage files are lost after app stops debugging

Using PCLStorage in Xamarin Forms I can create a local folder and store images downloaded from Azure.

I can then successfully test to see of the images exists using

ExistenceCheckResult fileExist = await MyFolder.CheckExistsAsync(fileName);

However, once the app has been stopped (by stopping debugging in Visual Studio) and restarted, if I run the test code above, it fails and tells me the images do not exist.

Do files then only exist for the time the app is running?

This thread looks like it could possibly cover what you are experiencing:

https://forums.xamarin.com/discussion/87498/i-am-using-pclstorage-where-are-the-files-going-to

Reading up on this, the file persistence side of things looks like debugging should not affect it, as once it writes the file - then it's in the specified location.

Also - looking at PCLStorage and the last time it was modified, if this is a new addition to your project, I can't say I would recommend it, as it looks like it is no longer being worked on, and hasn't been for some time.

I would go with an implementation from System.IO as it is now supported within .net standard 2.0 - and there appear to be lots of great examples for you to follow.

If this doesn't help, then post some more of your source code so that it can be looked into in further detail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM