一个简单 ios 天气预报的实现。
1.首先获得SBjson.
http://download.csdn.net/download/duxinfeng2010/4484842点击打开链接 第三方。
2.获得中国天气的 api 接口。 101010100为城市代码的编号。可以参照
http://blog.csdn.net/duxinfeng2010/article/details/7830136
以北京为例
http://m.weather.com.cn/data/101010100.html 格式为json。
3.获取天气接口内容。显示在 iphone模拟器上。
- //获取API接口
- NSURL *url = [NSURL URLWithString:@"http://m.weather.com.cn/data/101010100.html"];
- //定义一个NSError对象,用于捕获错误信息
- NSError *error;
- NSString *jsonString = [NSString stringWithCont