AFNetWorking 2.0 使用
/ { dqj = "454545\U5143"; dz = ""; id = 44; jpcs = "0\U6b21\U51fa\U4ef7"; jssj = "2014-11-29 12:48:24"; mc = 454545; qpj = "454545\U5143"; tp = "http://122.225.106.234:8082/ProjectManage/UploadImages/1.png"; zt = "\U8fdb\U884c\U4e2d"; } / -(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];
}</pre>
本文由用戶 md3c 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!