//
//  main.m
//  03-plist文件的回顾
//
//  Created by xiaomage on 15/12/29.
//  Copyright © 2015年 小码哥. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
       // 数组
        NSArray *names1 = @[@"yjh", @"gxq", @"mj", @"nj"];
        BOOL flag1 = [names1 writeToFile:@"/test.plist" atomically:YES];
        
        NSDictionary *persons2 = @{
                                  @"name" : @"yjh",
                                  @"age" : @18,
                                  @"height" : @1.88
                                  };
        BOOL flag2 = [persons2 writeToFile:@"/Users/mctc/Desktop/a.plist" atomically:YES];
        
        NSArray *persons3 = @[
                             @{@"name" : @"mj", @"age":@38},
                             @{@"name" : @"yjh", @"age":@25, @"friends":@[@"大神11期", @"sz"]}
                             ];
        BOOL flag3 = [persons3 writeToFile:@"/Users/mctc/Desktop/a.plist" atomically:YES];
        if (flag3) {
            NSLog(@"写入成功!");
        }
        
        
        NSArray *dataArr4 = @[
                         @{@"name":@"单肩包", @"icon":@"danjianbao"},
                         @{@"name":@"钱包", @"icon":@"qianbao"},
                         @{@"name":@"链条包", @"icon":@"liantiaobao"},
                         @{@"name":@"手提包", @"icon":@"shoutibao"},
                         @{@"name":@"双肩包", @"icon":@"shuangjianbao"},
                         @{@"name":@"斜挎包", @"icon":@"xiekuabao"}
                         ];
        BOOL flag4 = [dataArr4 writeToFile:@"/Users/mctc/Desktop/a.plist" atomically:YES];
        if (flag4) {
            NSLog(@"写入成功!");
        }
       
        NSArray *persons5 = [NSArray arrayWithContentsOfFile:@"/Users/mctc/Desktop/a.plist"];
        NSLog(@"%@", persons5);
        /*
         (
         {
         icon = danjianbao;
         name = "\U5355\U80a9\U5305";
         },
         {
         icon = qianbao;
         name = "\U94b1\U5305";
         },
         {
         icon = liantiaobao;
         name = "\U94fe\U6761\U5305";
         },
         {
         icon = shoutibao;
         name = "\U624b\U63d0\U5305";
         },
         {
         icon = shuangjianbao;
         name = "\U53cc\U80a9\U5305";
         },
         {
         icon = xiekuabao;
         name = "\U659c\U630e\U5305";
         }
         )
         */
    }
    return 0;
}