iOS App Rejection due to 2.23 - iOS 数据存储指南

标签 ios objective-c app-store appstore-approval

这是 Apple 关于拒绝的消息:

2.23 - Apps must follow the iOS Data Storage Guidelines or they will be rejected 2.23 Details

On launch and content download, your app stores 6.5 MB, which does not comply with the iOS Data Storage Guidelines.

Next Steps

Please verify that only the content that the user creates using your app, e.g., documents, new files, edits, etc. is backed up by iCloud as required by the iOS Data Storage Guidelines. Also, check that any temporary files used by your app are only stored in the /tmp directory; please remember to remove or delete the files stored in this location when it is determined they are no longer needed.

Data that can be recreated but must persist for proper functioning of your app - or because users expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCRUFLIsExcludedFromBackupKey attribute.

我检查了设备和模拟器的应用程序数据文件。我发现如果应用程序使用了一段时间,它的总应用程序数据可以在启动时存储 5-6 MB。但是我卸载并重新安装了应用程序并再次检查,我在应用程序启动时看到 ~3MB 数据存储。

我没有存储任何 Core Data 数据库或任何其他数据库文件。但我意识到 Google Analytics 和 Google Tag Manager 将一些 sqlite 数据存储在这条路径上:“AppData/Library”。我的意思是它不存储在这条路径上:“AppData/Library/Caches”。它对 iOS 数据存储指南有什么影响吗?

顺便说一句,iCloud 已禁用应用程序。

我还使用 SDWebImage 下载图像,它在启动时存储了将近 3 MB 的图像,并将图像数据存储在这个路径上:“AppData/Library/Caches”

您知道我应该如何处理这个问题吗?

最佳答案

我昨天刚收到同样的拒绝信息。

我在 application:didFinishLaunchingWithOptions: 中使用以下代码来查看我的应用程序在文档文件夹中有什么以及关于 iCloud 备份的每个项目的权限是什么:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSArray *documents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:basePath error:nil];
NSURL *URL;
NSString *completeFilePath;
for (NSString *file in documents) {
    completeFilePath = [NSString stringWithFormat:@"%@/%@", basePath, file];
    URL = [NSURL fileURLWithPath:completeFilePath];
    NSLog(@"File %@  is excluded from backup %@", file, [URL resourceValuesForKeys:[NSArray arrayWithObject:NSURLIsExcludedFromBackupKey] error:nil]);
}

我在该文件夹中有一些文件正在与 iCloud 同步。因此,我没有将这些文件保存在另一个地方,而是将 NSURLIsExcludedFromBackupKey 键的资源值设置为 YES 以排除这些文件被 iCloud 备份,如下所示:

NSURL *URL = [NSURL fileURLWithPath:photoPath];
[URL setResourceValue:@(YES) forKey:NSURLIsExcludedFromBackupKey error:nil];

我今天再次发送我的应用程序以查看是否有效。

希望这对您有所帮助。

关于iOS App Rejection due to 2.23 - iOS 数据存储指南,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28795975/

相关文章:

ios - 如何在 Xcode 中加载本地 json 文件以进行单元测试?

ios - 将 AnyObject 保存到 NSUserdefaults

app-store - iOS 编程 - 如何发现应用是从哪个(国家/地区的)应用商店下载的

ios - RN能通过苹果应用商店审核吗?

ios - Bundle ID Blunder - 但这真的是一个问题吗?

iphone - UITableviewCell 中的一个按钮

ios - 我可以在 iOS 上将普通的 OpenGL ES 2.0 与 Kobol2D/cocos2d 混合使用吗?

ios - 尝试从自定义单元格中恢复 View

ios - 如何在 ios 中获取 GCM 通知

ios - 单击按钮时如何保留 UIAlertController?