gpt4 book ai didi

ios - 有没有办法在 iOS 中标记文件,以便在低存储情况下它们不会从 Library/Caches 目录中清除

转载 作者:行者123 更新时间:2023-11-28 17:31:07 25 4
gpt4 key购买 nike

我们有一个使用 Newsstand 工具包开发的应用程序,因此文件存储在 Library/Caches 中,我们不能因为使用 Newsstand 而更改位置。我们希望这些文件不会在存储空间不足的情况下被清除。所以我们根据 iOS Data Storage Guidelines 将它们都标记为“不备份”属性: https://developer.apple.com/icloud/documentation/data-storage/index.html

“4. 使用“不备份”属性指定应保留在设备上的文件,即使在存储空间不足的情况下也是如此。”

但不幸的是,它们都被清除了(我们在 iOS 11.3-12.0 中测试过)。我们可以使用其他一些方法来禁用清除吗?使它起作用的任何其他想法。谢谢!

最佳答案

不幸的是,您无法阻止在存储空间不足的情况下清除所有背部问题。

Newsstand Kit 允许您通过设置 NKLibrarycurrentlyReadingIssue 属性来指定用户当前正在阅读的期刊。

根据文档:“Newsstand Kit 在清除由于可用闪存级别低而导致的问题时会考虑此设置。”

https://developer.apple.com/documentation/newsstandkit/nklibrary/1615812-currentlyreadingissue?language=objc

没有办法强制 NewsstandKit 在存储空间不足的情况下保留所有旧刊。

请参阅报亭常见问题解答,特别是“我的所有问题是否会无限期地自动存储在用户的设备上?”:

https://developer.apple.com/library/archive/technotes/tn2280/_index.html#//apple_ref/doc/uid/DTS40011215-CH1-MANAGING_CONTENT-CAN_I_MOVE_MY_ISSUES_OUT_OF_THE_DEFAULT_NEWSSTAND_STORAGE_LOCATION_ONCE_THEY_RE_DOWNLOADED__OR_DOWNLOAD_ISSUES_TO_ANOTHER_LOCATION_

"Newsstand Kit provides a managed repository for your issues located at the contentURL for the NKIssue. This managed repository acts as a cache for the content you host on your servers, and like any cache is susceptible to eviction as system resources become low.

In such an event, the information you provide Newsstand Kit via the currentlyReadingIssue property and the date parameter in addIssueWithName:date: helps Newsstand Kit to prioritize which content is most critical for the user as it evicts elements from the cache. Your Newsstand app should be capable of re-downloading back issues at the user's request, should such resource constraints arise."

Newsstand Kit 优先考虑它在低存储情况下保留的问题,不幸的是,除了保持 currentlyReadingIssue 属性为最新之外,您无法对此施加任何影响。

关于ios - 有没有办法在 iOS 中标记文件,以便在低存储情况下它们不会从 Library/Caches 目录中清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52507367/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com