当前位置 博文首页 > xixi:直接读取服务器的一个json 文件

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

    作者:[db:作者] 时间:2021-08-07 18:53

        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;

    }



    cs
    下一篇:没有了