問題描述
我通過將目標 iOS 設置為 4 為我的客戶創建了一個應用程序.
但由于應用程序仍未提交到 Apple Store,我的客戶計劃將其升級到 iOS 5.0.
I have made an application for my client by keeping target iOS as 4.
But since the application still not submitted to Apple store, my client is planning to upgrade it for iOS 5.0.
為此,我閱讀了 Apple 的 指南,發現僅用戶生成的數據或應用程序無法重新創建的數據,應存儲在/Documents 目錄中,其余數據應存儲在/Library/Caches 目錄中"
For this I read the guideline from Apple and found that "Only user-generated data or that cannot otherwise be recreated by your application, should be stored in the /Documents directory and rest should be stored to /Library/Caches directory"
在我的應用程序中,我將應用內購買的服務器模型用于非消耗性產品.為此,我將所有下載的數據(基本上是書籍或雜志)存儲到 Documents 目錄中.數據庫也存在于同一目錄中,其中包含有關下載產品的詳細信息.
In my application, I am using server model of in-app purchase for non-consumable product. For this I am storing all my downloaded data (which are basically books or magazines) to Documents directory. The Database is also present in the same directory which contains the details about the downloaded products.
我的問題是,
1. 我是否必須更改代碼以將下載的數據存儲到 Library/Caches 目錄而不是 Documents 目錄?
2. 我的數據庫文件應該放在哪里(文檔或緩存)?
My question is,
1. Should I have to change my code to store the downloaded data to Library/Caches directory instead of to the Documents directory?
2. Where should my database file be placed (to Documents or Caches)?
如果我把它放在緩存中,那么我也必須改變檢索的邏輯,因為如果數據庫中存在記錄,則不需要更改文件的存在,它直接打開它用戶點擊雜志.
If I put it products in the Caches then I have to change the logic of retrieval also, since it is considered that if record is present in database, there is no need change the existence of the file and it directly opens it when user clicks on the magazine.
請在這個問題上指導我.
提前致謝.
Kindly guide me on this issue.
Thanks in advance.
更新:
我正在為那些仍然不確定這個問題的人更新這個.
使用接受答案的指導方針,我已經在我的 2 個應用程序中實現了這一點,并將它們提交到 Apple Store.兩者都在審查中獲得批準.
這可能會促進接受的答案中建議的解決方案是正確的.
UPDATED:
I am updating this for those who are still not sure about this problem.
Using the guideline of accepted answer, I have implemented this in 2 of my applications and submitted them to Apple Store. Both were approved in review.
This may promote that the solution suggested in the accepted answer is correct.
推薦答案
以下是取舍:
- 如果您將文件放在 Documents 目錄中,那么它們會被備份到 iTunes 或 iCloud,但如果它們太大并且可以再次下載文件,那么 Apple 可能會拒絕您的應用
- 如果您將文件放在緩存目錄中,那么它們不會被備份,Apple 也不會拒絕您的應用.但是,當 iOS 5 空間不足時,它可能會刪除其中的所有文件.
- If you put your files in the Documents directory then they are backed up to iTunes or iCloud but if they are too big and it's possible to download the files again then Apple may reject your app
- If you put your files in the Cache directory then they won't be backed up and Apple won't reject your app. However, when iOS 5 gets low on space it may delete all the files in there.
但是,對于 iOS 5.0.1,還有第三種選擇:
However, with iOS 5.0.1 there is a third option:
- 將文件放在 Documents 中,但對其進行標記,以免備份.有一個技術說明 (QA1719)如何做到這一點.
- Put files in Documents but flag them so that they are not backed up. There's a technote (QA1719) on how to do this.
我認為這可能是最適合你的答案.
I think this is probably the best answer for you.
這篇關于iOS 5 不允許將下載的數據存儲在 Documents 目錄中?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!