AFNetworking 异步请求远程数据
- (void) sendRequestByNet:(NSString *) beginNum setDepartId:(NSString *)departmentId { NSString *url = @"url"; NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; parameters[@"req_number"] = beginNum; parameters[@"departmentID"] = departmentId; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json", @"text/plain", @"text/html", nil]; [manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSArray *resArr = responseObject; for(NSDictionary *dict in resArr){ SkNewsFrame *frame = [[SkNewsFrame alloc]init]; SkNews *news = [SkNews newsWithDict:dict]; frame.news = news; [_newsFrameArray addObject:frame]; } [self.SksNewsTableView reloadData]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"error -- %@",error); }]; }
相关推荐
zuojinmin 2019-06-26
倾城一屁博妹一笑 2020-06-12
crypond 2019-12-04
陈凯昂 2013-07-17
yuj00 2015-05-14
wangzhen 2018-12-24
crypond 2018-08-23
crypond 2019-07-01
大黑 2019-06-26
86344553 2019-06-20
wangzhen 2019-06-20
陈凯昂 2019-06-20
crypond 2018-12-24
daiyelang 2016-08-13
倾城一屁博妹一笑 2016-08-11
wangzhen 2016-05-24
zoutian00 2016-05-03
郎lang郎 2016-04-20