AFNet 例子
来源:互联网 发布:搭建数据库服务器 编辑:程序博客网 时间:2024/05/17 06:35
NSMutableURLRequest *request = [self.hfClientrequestWithMethod:@"GET"path:
@"http://9snow.org/weather/api?city=%E5%8C%97%E4%BA%AC"
parameters:nil];
[request setTimeoutInterval:30];
//
[AFJSONRequestOperationaddAcceptableContentTypes:[NSSetsetWithObject:@"text/html"]];
AFJSONRequestOperation *operation = [AFJSONRequestOperationJSONRequestOperationWithRequest:request success:^(NSURLRequest *request,NSHTTPURLResponse *response, id JSON)
{
NSLog(@"json %@",[JSONclass]);
_resultTextView.text = [NSStringstringWithFormat:@"%@",JSON];
// do something with return data
}failure:^(NSURLRequest *request,NSHTTPURLResponse *response, NSError *error,id JSON)
{
// code for failed request goes here
NSLog(@"%@",[errordescription]);
_resultTextView.text = [NSStringstringWithFormat:@"%@",JSON];
}];
operation.JSONReadingOptions =NSJSONReadingAllowFragments;
[operation start];
- AFNet 例子
- afnet
- afnet
- AFNet post 时增加参数
- iOS 使用AFNet上传图片(多张)
- 使用AFNet分别请求json、xml以及plist的数据
- 例子
- 例子
- 例子
- 例子
- & + 例子
- / 例子
- 例子
- 例子
- 例子
- 例子
- 例子
- 例子
- 精通PLSQL1:PLSQL运行环境配置
- 什么是用户界面特权隔离机制
- remove
- 非常喜欢的jquery 函数
- ReentrantLock代码剖析
- AFNet 例子
- HTTP请求(GET与POST区别)和响应
- UML建模之时序图(Sequence Diagram)
- 从创业失败中学到的七条教训
- spring3.0注解
- qt 移植(转载)
- 虚拟机建立Linux下的FTP服务器
- perl程序中shift的用法
- 数组大折腾