iphone - 我的 iphone 应用程序因这个原因被拒绝 "We found that your app does not follow the iOS Data Storage Guidelines,..."

标签 iphone ios storage ios5

我的 iPhone 应用最近被拒绝了,原因如下:

“我们发现您的应用不符合 iOS 数据存储指南,这不符合 App Store 审核指南。”

对于这个应用程序,我将数据库(sqlite 文件)存储在 iOS 5.0.1 及更高版本的/Documents/目录中,对于 iOS 5.0 及以下版本,我使用了 Library/Cache 目录。

对于我从服务器下载的其他数据,如 PDF 和艺术品图像,我采用与上述相同的方法,例如: iOS 5.0.1 及更高版本:将这些数据保存到/Documents/目录中 iOS 5.0 及更早版本:将数据保存到 Library/Cache 目录。

这种方法是否正确?

根据 Apple 指南: 重要:新的“不备份”属性仅供 iOS 5.0.1 或更高版本使用。在 iOS 5.0 及更早版本上,应用程序需要将其数据存储在/Library/Caches 中以避免备份。由于此属性在旧系统上会被忽略,因此您需要确保您的应用程序在您的应用程序支持的所有 iOS 版本上都符合 iOS 数据存储指南。

对于为 iOS 5.0.1 及更高版本存储的数据的“不备份”属性分配也非常困惑。我需要为哪些文件分配此标志?我可以将它用于数据库吗?

需要摆脱这些拒绝,因为它已经发生了两次。请为我的应用程序存储数据提供一些指导。提前致谢。期待积极的回应。

最佳答案

检查 https://developer.apple.com/icloud/documentation/data-storage/

具体来说:

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.

将 SQLite 数据库存储在 caches 文件夹中并设置 donotbackup 标志,这将阻止缓存清理系统删除文件

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    const char* filePath = [[URL path] fileSystemRepresentation];

    const char* attrName = "com.apple.MobileBackup";
    u_int8_t attrValue = 1;

    int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
    return result == 0;
}

我在我的应用程序中使用了一个数据库并将其存储在缓存文件夹中(设置了上述标志)并且刚刚获得批准没问题。

此外,您可以将数据存储在文档目录的子文件夹中,我相信它不会得到备份,但会保留。

关于iphone - 我的 iphone 应用程序因这个原因被拒绝 "We found that your app does not follow the iOS Data Storage Guidelines,...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8767981/

相关文章:

iphone - iPhone可以设置视频报警吗?

java - 如何创建简单的网络服务

ios - 使用 Decodable 解码同一键中的不同对象数组

swift - 您需要帮助在连接到步进器的标签中存储数字

c++ - 存储和缓存的选择

Android 应用小部件 : Data storage

iPhone:在prepareForSegue方法中防止popover segue?

iphone - UILongPressGestureRecognizer 可以和 touchesMoved 这样的触摸事件一起使用吗?

ios - 从 MtlTexture getBytes 创建 CVPixelBufferRef

ios - 特定 CGRect 中的 UIGraphicsGetImageFromCurrentImageContext