数据持久化-plist

plist 是iOS 开发中一种数据持久化的方式 后续还会介绍 NSUserDefaults 归档、数据库...
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    NSString *path = [NSString stringWithFormat:@"%@/Library/Caches/demo.plist",NSHomeDirectory()];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    
    [dict setObject:@"123" forKey:@"密码"];
    [dict writeToFile:path atomically:YES];
    NSLog(@"%@",NSHomeDirectory());
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

你可能感兴趣的:(数据库,数据,ios开发,plist,数据持久化)