File attribute to prevent purging of data in iOS 5.0.1?
-
27-10-2019 - |
Question
WIth iOS 5.0.1 the new file attribute to prevent data from being backed up has been introduced but I remember that I read somewhere that there is also a new flag that can be set to prevent data form being purged in low memory situations. Does anybody know?
I know this article here: https://developer.apple.com/library/ios/#qa/qa1719/_index.html#//apple_ref/doc/uid/DTS40011342 But it is dealing with backup flags only and states that files that should not be purged should be placed in the document's folder. I know all that but I'm looking specifically for a way to prevent data from being purged that is NOT in the documents folder.
Solution
Just store your data in <Application_Home>/Library/Private Documents
, as stated in that article. It won't get purged from there, and you can then set the do-not-backup flag.
OTHER TIPS
You are looking for these methods in MonoTouch.Foundation.NSFileManager:
public static bool GetSkipBackupAttribute (string filename);
public static bool GetSkipBackupAttribute (string filename, out NSError error);
public static NSError SetSkipBackupAttribute (string filename, bool skipBackup);