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); }]; }
?
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。