码迷,mamicode.com
首页 > Web开发 > 详细

AFNetworking网络请求数据

时间:2015-01-12 19:09:05      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

        //创建AFNetworking的请求操作
    AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://lib.wap.zol.com.cn/ipj/docList.php?class_id=%ld&page=%ld&vs=and380&retina=1", selfId, page + 1]]]];
    
        //设置AFNetworking返回的数据 自动进行json解析
    operation.responseSerializer = [AFJSONResponseSerializer serializer];
    
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
        [_netDataDelegate dataRead:responseObject];
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        

        NSLog(@"%@", error);
    }];
        //开启数据请求
    [operation start];

 

AFNetworking网络请求数据

标签:

原文地址:http://www.cnblogs.com/tian-sun/p/4218969.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!