简单的生成Plist文件

这里写代码  

NSMutableDictionary *dict=[NSMutableDictionary dictionary];

        [dict setObject:@"zhangsan" forKey:@"username"];
        [dict setObject:@"123456" forKey:@"password"];
        [dict setObject:[NSDate date] forKey:@"date"];
        NSArray * array=@[@"[email protected]",@"[email protected]"];
        [dict setObject:array forKey:@"email"];
        //将词典对象归档存入文件
        [dict writeToFile:@"dict.plist" atomically:YES];
//        将文件内容读成词典对象
        NSDictionary *dict2=[NSDictionary dictionaryWithContentsOfFile:@"dict.plist"];
        NSLog(@"dict2:%@",dict2);
  //获取存入plist文件的路径      
        NSFileManager *fm=[NSFileManager defaultManager];
        NSLog(@"%@",[fm currentDirectoryPath]);片

你可能感兴趣的:(知识图谱)