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 )




原文地址:https://www.cnblogs.com/mybkn/p/2418971.html