ios數據本地存儲備份指導

此爲本人按照蘋果英文文檔翻譯。可英漢對照來看,歡迎提寶貴意見。

官方地址https://developer.apple.com/icloud/documentation/data-storage/index.html

To ensure that backups are as efficient as possible, store your app’s data according to the following guidelines:

爲了確保儘可能高效的備份,請根據以下指南存儲你的應用程序數據:

Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the <Application_Home>/Documents directory and will be automatically backed up by iCloud.

只有用戶生成的文件和數據,或,否則不能被重新創建應用程序數據,應該存儲在< Application_Home > /Documents 目錄下並將通過iCloud自動備份這些文件。

Data that can be downloaded again or regenerated should be stored in the <Application_Home>/Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.

一些可以被下載的,或者可以再次自動產生的數據,應該存儲在< Application_Home > /Library/Caches目錄下。可以放在緩存目錄下的內容包括數據緩存,下載內容。如雜誌、報紙、地圖應用程序。

Data that is used only temporarily should be stored in the <Application_Home>/tmp directory. Although these files are not backed up to iCloud, remember to delete those files when you are done with them so that they do not continue to consume space on the user’s device.

一些臨時的數據應該存儲在< Application_Home > / tmp目錄下。儘管這些文件沒有通過iCloud備份。記得要刪除這些文件當你用過他們後,使他們不繼續消費用戶設備上的存儲空間。

Use the "do not back up" attribute for specifying files that should remain on device, even in low storage situations. Use this attribute with data that can be recreated but needs to persist even in low storage situations for proper functioning of your app or because customers expect it to be available during offline use. This attribute works on marked files regardless of what directory they are in, including the Documents directory. These files will not be purged and will not be included in the user's iCloud or iTunes backup. Because these files do use on-device storage space, your app is responsible for monitoring and purging these files periodically.

使用“do not back up”屬性指定文件保存在設備上,即使在存儲不足的情況下。使用這個屬性可以使可再生數據在存儲空間不足的情況下仍然被保存,以便應用的一些特有功能,或者用戶想離線使用的功能來讀取這些數據。被這個屬性處理過的文件,無論他在那個目錄文件下,包括Documents 文檔目錄。這些文件都不要會被清除,不會通過iCloud或者iTunes備份。這些文件佔用的設備存儲空間,由你自己的應用負責定期監控和清理。

可以採用方法防治iCloud備份,此爲官方技術文檔。

https://developer.apple.com/library/ios/qa/qa1719/_index.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章