AFNetWorking 2.0 使用

下面是来客网 jb51.cc 通过网络收集整理的代码片段。

来客网小编现在分享给大家,也给大家做个参考。

/*
 {
    dqj = "454545U5143";
    dz = "";
    id = 44;
    jpcs = "0U6b21U51faU4ef7";
    jssj = "2014-11-29 12:48:24";
    mc = 454545;
    qpj = "454545U5143";
    tp = "http://122.225.106.234:8082/ProjectManage/UploadImages/1.png";
    zt = "U8fdbU884cU4e2d";
}
 */
-(void) requestUseAFJSONRequest{
    NSURL *postUrl = [Tool generateURL2WithServer:api_server andApi:api_auction_list andEncode:NO];
     
    NSURLRequest *request = [NSURLRequest requestWithURL:postUrl];
     
    AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation,id responSEObject) {
        NSLog(@"Success: %@",operation.responseString);
         
        NSString *requestTmp = [NSString stringWithString:operation.responseString];
        NSData *resData = [[NSData alloc] initWithData:[requestTmp dataUsingEncoding:NSUTF8StringEncoding]];
        //系统自带JSON解析
        NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:resData options:NSJSONReadingMutableLeaves error:nil];
         
    } failure:^(AFHTTPRequestOperation *operation,NSError *error) {
        NSLog(@"Failure: %@",error);
        //        [SVProgressHUD dismissWithError:@"提交失败,请重试"];
    }];
    [operation start];
}

以上是来客网(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。

以上是来客网为你收集整理的AFNetWorking 2.0 使用全部内容,希望文章能够帮你解决AFNetWorking 2.0 使用所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。