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 )

 




posted on 2012-03-27 09:14  老Zhan  阅读(351)  评论(0编辑  收藏  举报