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

 苹果审核折腾人啊,这次是数据存储的事

 

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

2.23应用程序必须遵循iOS数据存储指南,否则他们将被拒绝

 

We found that your app does not follow the iOS Data Storage Guidelines, which is required per the App Store Review Guidelines.

我们发现你的应用程序没有遵循iOS数据存储的指导方针, 这是每个应用程序商店要求审查指南。

 

In particular, we found that on launch and/or content download, your app stores 7.38MB. To check how much data your app is storing:

特别是,我们发现在启动或内容下载,你的应用程序商店7.38 mb。检查你的程序是多少数据存储:

 

- Install and launch your app

- Go to Settings > iCloud > Storage & Backup > Manage Storage

- If necessary, tap "Show all apps"

- Check your app's storage

——你的应用程序安装和启

——去设置> > >存储和备份iCloud管理存储

——如果有必要的话,点击显示所有应用程序

你的应用程序的存储——检查

 

The iOS Data Storage Guidelines indicate that only content that the user creates using your app, e.g., documents, new files, edits, etc., should be backed up by iCloud.

iOS数据存储指南表明,只有内容,使用你的应用程序的用户创建,例如文档、新文件,编辑等,应由iCloud备份。

 

Temporary files used by your app should only be stored in the /tmp directory; please remember to delete the files stored in this location when the user exits the app.

临时文件所使用的应用程序应该只被存储在/ tmp目录;请记住删除在这个位置的文件存储,当用户退出应用程序时。

 

Data that can be recreated but must persist for proper functioning of your app - or because customers 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 kCFURLIsExcludedFromBackupKey attribute.

数据,可以重新创建但是必须持续正常运行你的应用程序——或因为客户期望它能离线使用,应该被标上不支持属性。对于NSURL对象,添加NSURLIsExcludedFromBackupKey属性来防止相应的文件从备份。 为CFURLRef对象,使用相应的kCFURLIsExcludedFromBackupKey属性。

 

For more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.

有关更多信息,请见技术问答1719:我如何防止文件备份到iCloud和iTunes ?。

It is necessary to revise your app to meet the requirements of the iOS Data Storage Guidelines.

For discrete code-level questions, you may wish to consult with Apple Developer Technical Support. Please be sure to:

 

- include the complete details of your rejection issues

- prepare any symbolicated crash logs, screenshots, and steps to reproduce the issues for when the DTS engineer follows up.

有必要修改您的应用程序以满足需求的iOS数据存储指南。

对离散代码级问题,你可能会希望咨询苹果开发者技术支持。请务必:

——包括完整的细节,你的排斥问题

——准备任何symbolicated崩溃记录,截屏和步骤来再现问题当DTS工程师跟踪。

 

For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.

 

If you have difficulty reproducing this issue, please try testing the workflow as described in <https://developer.apple.com/library/ios/qa/qa1764/>Testing Workflow with Xcode's Archive feature".

关于如何symbolicate和读一个崩溃的日志,请见技术注意TN2151理解和分析iPhone OS应用程序崩溃报告。

 

如果你很难繁殖这个问题,请尝试测试工作流中描述的

< https://developer.apple.com/library/ios/qa/qa1764/ >测试工作流与Xcode的存档特性

 

 

 

 

Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.

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

 

Technical Q&A QA1764:Testing Workflow with Xcode's Archive feature

http://developer.apple.com/library/ios/#qa/qa1764/_index.html

 

https://developer.apple.com/library/ios/#technotes/tn2008/tn2151.html

Technical Q&A QA1719

How do I prevent files from being backed up to iCloud and iTunes?

Q:  My app has a number of files that need to be stored on the device permanently for my app to function properly offline. However, those files do not contain user data and don't need to be backed up. How can I prevent them from being backed up?

我的应用程序有很多文件,需要存储在设备上为我的应用程序功能永久妥善离线。然而,这些文件不包含用户数据和不需要备份。我怎样才能防止他们被备份?

A: On iOS, apps are responsible for ensuring that only user data and not application data is backed up to iCloud and iTunes. The exact steps necessary vary between iOS version, so this QA will describe the process for each version of iOS. For more information on exactly what data should or should not be backed up, see the App Backup Best Practices section of the iOS App Programming Guide.

答:关于iOS,应用程序负责确保只有用户数据,而不是应用程序数据备份到iCloud和iTunes。确切的必要步骤不同iOS版本,所以这QA将描述这个过程对于每个版本的iOS。更多信息正是数据应该或不应该备份,请参阅应用程序备份的最佳实践部分的iOS应用程序编程指南< http://developer.apple.com/library/ios/ >。

 

Important: Apps should avoid mingling app data and user data in the same file. Doing so will unnecessarily increase backup sizes and can be considered a violation of the iOS Data Storage Guidelines.

重要:应用程序应该避免混合应用程序数据和用户数据在同一个文件中。这样做将增加不必要的备份大小,可以被看作是违反了iOS数据存储指南。

iOS 5.1 and later

Starting in iOS 5.1, apps can use either NSURLIsExcludedFromBackupKey or kCFURLIsExcludedFromBackupKey file properties to exclude files from backups. Either of these APIs is preferred over the older, deprecated approach of directly setting an extended attribute. All apps running on iOS 5.1 should use these APIs to exclude files from backups.

iOS 5.1开始,用程序可以使用< http://developer.apple.com/library/ios/ > NSURLIsExcludedFromBackupKeykCFURLIsExcludedFromBackupKey文件属性来排除文件从备份。 这两种api是优先于年长的,过时的方法直接设置一个扩展属性。所有的应用程序运行在iOS 5.1应该使用这些api来排除文件从备份。

 

Listing 1  Excluding a File from Backups on iOS 5.1

排除一个文件备份

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
 
    NSError *error = nil;
    BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
                                  forKey: NSURLIsExcludedFromBackupKey error: &error];
    if(!success){
        NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
    }
    return success;
}

Back to Top

 

iOS 5.0.1

 

If your app must support iOS 5.0.1, you can use the following method to set the "do not back up" extended attribute. Whenever you create a file or folder that should not be backed up, write the data to the file and then call this method, passing in a URL to the file.

如果你的应用程序必须支持iOS 5.0.1,您可以使用以下方法来设置不支持扩展属性。当你创建一个文件或文件夹,不应该备份,将数据写入文件,然后调用这个方法,传入一个URL到文件。

 

 

Warning: The code that follows has been deprecated and should only be used on iOS 5.0.1 or earlier. When running in iOS 5.1, apps should use the NSURL and CFURL keys described above.

Listing 2 Setting the Extended Attribute on iOS 5.0.1

警告:后面的代码已经被弃用,只应该用于iOS 5.0.1或更早。在iOS 5.1运行时,应用程序应该使用上面描述CFURL NSURL和钥匙。

清单2设置扩展属性在iOS 5.0.1

 

#import <sys/xattr.h>

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL

{

    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);

 

    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;

}

Back to Top

 

iOS 5.0

It is not possible to exclude data from backups on iOS 5.0. If your app must support iOS 5.0, then you will need to store your app data in Caches to avoid that data being backed up. iOS will delete your files from the Caches directory when necessary, so your app will need to degrade gracefully if it's data files are deleted.

Back to Top

它不可能排除在iOS 5.0的数据备份。如果你的应用程序必须支持iOS 5.0,那么您将需要存储应用程序数据缓存来避免数据备份。iOS将会删除你的文件从缓存目录在必要的时候,所以你的应用程序将需要完全降低如果它的数据文件被删除。

 


Document Revision History

 

Date

Notes

2012-04-23

Updated for iOS 5.1

2011-11-10

-Fixed critical bug in code snippet.

 

New document that describes how an app can prevent files from being backed up to iCloud and iTunes.

 

 解决办法:

程序数据和图片、sqlite数据库---不需要云备份,(离线看需要本地数据)

用户数据(用户浏览的食谱图片、胎教音乐)---需要云备份

有临时文件就设置在  /tmp    ---缓存等临时文件,退出需要删除

 

我也遇到过,之前把所有数据都存在Documents下了,改了目录就通过了

 

 数据的问题: 11,只有用户产生的数据应该放到/Documents里,你app产生的不要放 12,下载可以重用的东西放/Library/Caches 13,临时的放/tmp,不用的时候记得删掉 14,用"do not back up"标记需要留在设备上的数据,那些没联网也可以保证使app运行的数据(别因为连不上网拿不到数据app运行不了) 他的意思,你把这个iOS Data Storage Guidelines看一遍再。

posted on 2012-10-16 11:45  coder狼  阅读(3822)  评论(0编辑  收藏  举报

导航