2011-11-23 110 views
2

其中一項iCloud建議是使用Library/Caches目錄來存儲不需要備份到雲中的文件。什麼是這個目錄的後向兼容性?如果iPhone OS 3.0上不存在,我是否需要創建它?我可以依靠它在那裏並使用這樣的代碼來獲得它的路徑嗎?對Caches目錄的向後兼容性

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); 
NSString *cachesDirectory = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; 

回答