转载于:http://www.williamlong.info/archives/2865.html
【app被拒】分享原因。。
引用
We found that your app does not follow the iOS Data Storage Guidelines, which is not in compliance with the App Store Review Guidelines.
In particular, we found book download (data) is not cached appropriately.
The iOS Data Storage Guidelines specify:
“1. Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the /Documents directory and will be automatically backed up by iCloud.
Data that can be downloaded again or regenerated should be stored in the /Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.
Data that is used only temporarily should be stored in the /tmp directory. Although these files are not backed up to iCloud, remember to delete those files when you are done with them so that they do not continue to consume space on the user’s device.
Use the “do not back up” attribute for specifying files that should remain on device, even in low storage situations. 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. These files will not be purged and will not be included in the user’s iCloud or iTunes backup. Because these files do use on-device storage space, your app is responsible for monitoring and purging these files periodically.”
For example, only content that the user creates using your app, e.g., documents, new files, edits, etc., may be stored in the /Documents directory - and backed up by 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.
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 more information, please see Technical Q&A 1719: How do I prevent files from being backed up to iCloud and iTunes?.
It would be appropriate 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 any symbolicated crash logs, screenshots, or steps to reproduce the issues when you submit your request. For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS Application Crash Reports.
如果你的App用Documents目录存储非用户添加数据,当你上传软件时,平果的审核人员会抛出这个Bug:
一 般来说Documents目录用来存储永久性数据,该目录的会被iTunes同步备份(当然我不赞成存电影)。当iCloud出现后往Documents 目录存数据变得很不一般,为了减小同步数据的大小,通过iTunes下载的音乐、电影、铃声,通过APP Store下载的程序,电子书,iAp下载的付费内容可以被存到iCloud,你的程序产生的数据或下载的内容一般不能存到iCloud(如有错误,请指正)http://developer.apple.com/icloud/documentation/data-storage/。因为Documents目录要被iCloud同步备份,所以你程序下载的数据或用户can recreated的数据不要存储到Documents目录,好笑吧。苹果给 出了解决方案,存到/Library/Caches或 者/tmp目录下,tmp用来存储临时性数据,果断舍弃。剩下Caches目录,这个名字总让人觉得不 踏实,官方文档对该目录的说明是:1、该目录不被Itunes和iCloud备份(可以接受)2、当用户磁盘空间告急的时候,系统会删除该目录下的数据 (祈祷用户的磁盘空间够大) 另: 苹果官方人员口头补充说软件版本升级时该目录会被保存(可信吗)。一位热心的开发者做了一个内存测试发现当内存告急的时候,Caches目录数据同样会被清空:
Oct 14 10:16:03 unknown deleted[6673] : 2ffe2000 __DeleteThirdPartyCaches_block_invoke_4: Removed ‘com.xxx.xxx’ cache at /private/var/mobile/Applications/xxxxxx/Library/Caches (295290041 bytes)
Oct 14 10:16:03 unknown deleted[6673] : 2ffe2000 DeleteBytes: Third party cache total size is 297211408B (283 MiB); deleted 295290041B (281 MiB)
Oct 14 10:16:03 unknown deleted[6673] : 2ffe2000 DeleteBytes: Already deleted 295290041B (281 MiB) of 157286400B (150 MiB), skipping additional steps
Oct 14 10:16:03 unknown deleted[6673] : 2ffe2000 DeleteBytes: summary: known to have deleted 295290041B (281 MiB), more than requeste
苹果 iOS 5系统增加了一个新的机制——在设备容量空间不足的情况下自动清除高速缓存文件或临时目录的内容。这意味着,如果你设备的容量快到极限了,应用存储的很多离线内容,包括文章、杂志、图书、漫画以及其他数据都将被清空!如果用户需要,将不得不重新下载这些内容。
关于苹果 iOS 5 的这次“变革”,困扰了不少开发者。新规则实施之后,用户想使用离线数据将会有很多困难,而且也有开发者反应他们的应用通不过苹果应用审核团队的审核。关 于这次更新的讨论非常“火热”,当然也是相当杂乱,因为其中参杂了好几个问题,简单的归纳就是:
缓存和临时文件夹的语义问题
苹果相关文件的变化
应用审核被拒
iTunes 和 iCloud 到底备份了哪些内容
iOS 5 行为变化
下面我们来分开讨论以上5个问题:
1.缓存和临时文件夹的语义问题
虽然苹果应用使用的临时文件夹同跟目录下的 /tmp 并非同一个文件夹,但是开发者不应该认为它们有什么显著的差别,他们都是临时文件夹,所以性质相同。如果你有过 OS X 、Unix 或 Linux 背景,你应该能理解,苹果其实没有义务向用户保证缓存和临时文件到底能保存多久。
即使你以前从来没有听说过临时文件夹和缓存文件夹里面的东西会被系统删除这种情况,也不代表这个情况将来会有所改善,特别是苹果已经在文件中申明这些。
2.苹果相关文件的变化
最晚到2011年6月29日的时候,iOS发布之前,苹果的文件(web.archive.org存档,被墙)中涉及到/Documents 的部分是这样描述的:
Use this directory to store user documents and application data files.
使用这个文件夹来存储用户文件和应用数据文件。
这个说明相当容易理解,这也很清楚的说明了为什么开发者对 iOS 5 中文件目录规则的改变不满。
关于/Library/Caches 是这样说明的:
Use this directory to write any application-specific support files that you want to persist between launches of the application or during application updates. Your application is generally responsible for adding and removing these files. It should also be able to re-create these files as needed because iTunes removes them during a full restoration of the device.
使用这个文件夹来写应用在运行期间和更新期间需要用到的任何文件。你的应用必须负责好添加和删除这些文件。而且这些文件应该是可以被重建的,因为 iTunes 会在还原设备备份的时候删除这些文件。
这段说明中的措词,不可否认是比较模糊的。读这段说明的时候我的第一印象就是苹果在 iOS 5 中实施了一些与本条款相矛盾的根本性改变。但换个角度来说,通过”generally” 和 “able to re-create” 这些字眼,可以明显看出苹果基本上就是在警告开发者系统将怎么对待这些文件了。
iCloud 数据存储准则(需登录查看) 这样说明:
To ensure that backups are as efficient as possible, be sure to store your app’s data according to the following guidelines:
Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the /Documents directory and will be automatically backed up by iCloud.
2. Data that can be downloaded again or regenerated should be stored in the /Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.
3. Data that is used only temporarily should be stored in the /tmp directory. Although these files are not backed up to iCloud, remember to delete those files when you are done with them so that they do not continue to consume space on the user’s device.
译者:为了保证数据备份的可能性和有效性,请确保你的应用数据符合以下规则:
1.只有用户生成的文件、其他数据及其他程序不能重新创建的文件,应该保存在/Documents 目录下面,并将通过iCloud自动备份。
2.可以重新下载或者重新生成的数据应该保存在 /Library/Caches 目录下面。举个例子,比如杂志、新闻、地图应用使用的数据库缓存文件和可下载内容应该保存到这个文件夹。
3.只是临时使用的数据应该保存到 /tmp 文件夹。尽管 iCloud 不会备份这些文件,但在应用在使用完这些数据之后要注意随时删除,避免占用用户设备的空间。
如果我们暂时暂时忘记很多新闻、杂志、地图应用的唯一目的就是显示离线内容这个事实的话,以上条款还是相当清楚和有意义的。
3.应用审核被拒
最近不断有开发者反应在 Documents 文件夹存储 “任何/一些/很多”(any/some/much) 数据的应用被苹果的应用审核团队拒绝。但有些开发者已经成功地向应用审核团队解释他们的应用存储文件的原理,并表明他们的应用是完全遵守开发规则的。
现在看来,苹果应用审核团队也并没有十足的把握判断到底哪些文件夹中存储的哪些数据是用户生成的,而哪些数据又是可以重新下载和重新生成的。
4.iTunes 和 iCloud 到底备份了哪些内容
应用文件夹所有内容都会备份,除了:
应用程序本身bundle(.app)
/tmp
/Library/Caches directory
这在iCloud 数据存储准则中有很清楚的说明。
其他的文件也清楚的申明了,应用程序支持文件夹也会被iTunes备份。在讨论中一些开发者建议应用支持文件夹应该比缓存文件夹更安全点(更持久点)。 在我看来,自从iCloud 存储推出以来,苹果应用审核团队将会重点打击那些需要存储大量应用支持文件在Documents 文件夹中的应用。
5.iOS 5 的行为变化
在 iOS 5 设备中,当用户收到存储空间不足的警告时,如果此时应用没有运行,那么该应用的 /Library/Caches文件夹中的数据将被清空。
这意味着在 iOS 5 中应用将没有任何文件夹可以存储以下文件:
没有备份到iTunes/iCloud的文件
删除不会带来危险的文件
显然,现在要让 iOS 5.0 给开发者有一个文件夹存放文件已经不可能了,但是假如有足够的开发者向苹果表明他们确实需要这样一个文件夹来存储一些数据,我想在将来的版本当中,也许会出现改善