2011年10月24日 星期一

[iPhone] iOS Data Stors Guidelines

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.

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.


Well, based on this, i guess lots of developers using "example" have to update their apps!

2011年10月20日 星期四

[iPhone] Based on iCloud, need to change the data storage directory

iOS data storage guideline :
https://developer.apple.com/icloud/documentation/data-storage/

Problem :
Since iCloud will sync the data in 'Documents' directory, we need to change the data storage directory to 'Librarys/Caches/ if it's not users related data.

Solution :
Replace 'NSDocumentDirectory' by 'NSCachesDirectory' while saving data.