简单的生成Plist文件

这里写代码  

NSMutableDictionary *dict=[NSMutableDictionary dictionary];

        [dict setObject:@"zhangsan" forKey:@"username"];
        [dict setObject:@"123456" forKey:@"password"];
        [dict setObject:[NSDate date] forKey:@"date"];
        NSArray * array=@[@"zhangsan@163.com",@"zhangsan@qq.com"];
        [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]);片
阅读更多
文章标签: plist文件
个人分类: 知识图谱
下一篇归档与解归档
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭