获取天气情况

NSError *error;
    //获取温度
    //加载一个NSURL对象
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://api.thinkpage.cn/v3/weather/daily.json?key=poaufucs3ixc3c6x&location=hangzhou&language=zh-Hans&unit=c&start=0&days=1"]];
    //将请求的url数据放到NSData对象中
    NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    //IOS5自带解析类NSJSONSerialization从response中解析出数据放到字典中
    NSDictionary *weatherDic = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableLeaves error:&error];
    //    NSLog(@"%@",weatherDic);
    NSArray *weatherInfo = [weatherDic objectForKey:@"results"];

原文地址:https://www.cnblogs.com/Mrliheng/p/5773235.html