一、NSUserDefaults
二、Plist
- (void)writeToPlist{
NSString*name=@"longquan";
NSString*phoneNumber=@"112222222";
NSString*age=@"11";
NSMutableArray*array=[[NSMutableArrayalloc]init];
[arrayaddObject:name];
[arrayaddObject:phoneNumber];
[arrayaddObject:age];
NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString*path=[pathsobjectAtIndex:0];
NSString*filename=[pathstringByAppendingPathComponent:@"Date.plist"];
[arraywriteToFile:filenameatomically:YES];
}
- (void)readFromPlist{
NSArray*paths1=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString*path1=[paths1objectAtIndex:0];
NSString*filename1=[path1stringByAppendingPathComponent:@"Date.plist"];
NSMutableArray*array1=[[NSMutableArrayalloc]initWithContentsOfFile:filename1];
NSLog(@"array---%@",array1);
}
三、数据库,iOS自带CoreData,或者用第三方的FMDB,MagicalRecord