iphone开发中的数据存储:初
iphone上的数据存储有四种模式:
Property lists 属性列表
Object archives (or archiving) 对象归档
SQLite3 (iOS’s embedded relational database)
Core Data (Apple’s provided persistence tool)
存储中经常需要提取两个相关的目录路径:Documents和tmp
Getting the Documents Directory :
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filename = [documentsDirectory stringByAppendingPathComponent:@"theFile.txt"];
Getting the tmp Directory :
NSString *tempPath = NSTemporaryDirectory();
NSString *tempFile = [tempPath stringByAppendingPathComponent:@"tempFile.txt"];
文件存储分为单文件存储和多文件存储(Single-File Persistence 、Multiple-File Persistence )
作者:老Zhan
出处:http://www.cnblogs.com/mybkn/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。