直接读取服务器的一个json 文件

来源:互联网 发布:windows10数据恢复 编辑:程序博客网 时间:2024/06/06 01:57
    NSString *filePath = @"http://192.168.0.212:20000/ver.json";    NSData *data =[NSData dataWithContentsOfURL:[NSURL URLWithString:filePath]];    NSDictionary *dic = [data objectFromJSONData];    NSLog(@"%@",dic);


ps :

objectFromJSONData是  JSONKit.h 里面的一个方法

JSONKit 请百度自行下载


这个是ver.json 里面的内容

{"version":"1.0","filename":"order.zip","version_type":"total"}

结果:

{
    filename = "order.zip";
    version = "1.0";
    "version_type" = total;

}



0 0