蘋果審核折騰人啊,這次是數據存儲的事
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/ > NSURLIsExcludedFromBackupKey或kCFURLIsExcludedFromBackupKey文件屬性來排除文件從備份。 這兩種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; |
} |
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.
它不可能排除在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下了,改了目錄就通過了
數據的問題: 1-1,只有用戶產生的數據應該放到/Documents里,你app產生的不要放 1-2,下載可以重用的東西放/Library/Caches 1-3,臨時的放/tmp,不用的時候記得刪掉 1-4,用"do not back up"標記需要留在設備上的數據,那些沒聯網也可以保證使app運行的數據(別因為連不上網拿不到數據app運行不了) 他的意思,你把這個iOS Data Storage Guidelines看一遍再。
