[2014-06-01][转]apps须遵循iOS数…

来源:互联网 发布:淘宝的港货可以买吗? 编辑:程序博客网 时间:2024/04/30 15:20

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

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

 

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

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

 

We found that your app does not follow the iOS Data StorageGuidelines, which is required per the App Store ReviewGuidelines.

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

 

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

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

 

- Install and launch your app

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

- If necessary, tap "Show all apps"

- Check your app's storage

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

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

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

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

 

The iOS Data Storage Guidelines indicate that only content that theuser 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 /tmpdirectory; please remember to delete the files stored in thislocation when the user exits the app.

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

 

Data that can be recreated but must persist for proper functioningof your app - or because customers expect it to be available foroffline use - should be marked with the "do not back up" attribute.For NSURL objects, add the NSURLIsExcludedFromBackupKey attributeto prevent the corresponding file from being backed up. ForCFURLRef objects, use the correspondingkCFURLIsExcludedFromBackupKey attribute.

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

 

For more information, pleasesee Technical Q&A 1719: Howdo I prevent files from being backed up to iCloud andiTunes?.

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

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

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

 

- include the complete details of your rejection issues

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

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

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

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

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

 

For information on how to symbolicate and read a crash log, pleasesee Tech Note TN2151 Understanding and Analyzing iPhone OSApplication Crash Reports.

 

If you have difficulty reproducing this issue, please try testingthe workflow as described in Testing Workflow with Xcode's Archivefeature".

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

 

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

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

 

 

 

 

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

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

 

Technical Q&A QA1764:Testing Workflow with Xcode'sArchive 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

Howdo I prevent files from being backed up to iCloud andiTunes?Q:  My app has a number of files that needto be stored on the device permanently for my app to functionproperly offline. However, those files do not contain user data anddon't need to be backed up. How can I prevent them from beingbackedup?我的应用程序有很多文件,需要存储在设备上为我的应用程序功能永久妥善离线。然而,这些文件不包含用户数据和不需要备份。我怎样才能防止他们被备份?

A: On iOS, apps are responsible for ensuring that only user dataand not application data is backed up to iCloud and iTunes. Theexact steps necessary vary between iOS version, so this QA willdescribe the process for each version of iOS. For more informationon exactly what data should or should not be backed up, seethe AppBackup Best Practices section of the iOS App ProgrammingGuide.

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

 

Important: Apps should avoidmingling app data and user data in the same file. Doing so willunnecessarily increase backup sizes and can be considered aviolation of the iOS Data Storage Guidelines.

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

iOS5.1 and later

Starting in iOS 5.1, apps can useeither NSURLIsExcludedFromBackupKeyorkCFURLIsExcludedFromBackupKey fileproperties to exclude files from backups. Either of these APIs ispreferred over the older, deprecated approach of directly settingan extended attribute. All apps running on iOS 5.1 should use theseAPIs to exclude files from backups.

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

 

Listing 1  Excluding a File fromBackups on iOS 5.1

排除一个文件备份

Back to Top

 

iOS 5.0.1

 

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

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

 

 

Warning: The code that follows has been deprecated and should onlybe used on iOS 5.0.1 or earlier. When running in iOS 5.1, appsshould 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运行时,应用程序应该使用上面描述CFURLNSURL和钥匙。

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

 

#import

(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

 

iOS5.0

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

Back to Top

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

 

DocumentRevision History

 

 

解决办法:

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

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

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

 

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

 

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

0 0