简体   繁体   English

存储信息ios SDK

[英]Storing information ios SDK

So I have lots of application data for my application. 所以我的应用程序有很多应用程序数据。 However, This data does not necessarily need to be backed up to itunes. 但是,此数据不一定需要备份到iTunes。 Where would be the best place to store it? 哪里是最好的存放地点?

You can put it in the caches directory 您可以将它放在缓存目录中

  NSArray* cachePathArray = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
  NSString* cachePath = [cachePathArray lastObject];

or the temporary directory 或临时目录

NSTemporaryDirectory()

Note that there have been some concerns with iOS 5 as it sometimes clears the caches directory (which previous versions of iOS didn't, current iOS 5.0.1 in beta at the moment aims to solve this ). 请注意,iOS 5存在一些问题,因为它有时会清除缓存目录 (之前版本的iOS没有, 目前iOS 5.0.1处于测试版目前旨在解决此问题 )。 You need to be careful when storing large files to the documents folder in iOS 5 将大文件存储到iOS 5中的文档文件夹时需要小心

  NSArray* documentPathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString* documentPath = [documentPathArray lastObject];

because of big iCloud sync times. 因为大的iCloud同步时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM