第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

請(qǐng)求失?。翰豢山邮艿膬?nèi)容類型:使用AFNetworking 2.0的text / html

請(qǐng)求失?。翰豢山邮艿膬?nèi)容類型:使用AFNetworking 2.0的text / html

MYYA 2019-08-29 17:44:55
請(qǐng)求失?。翰豢山邮艿膬?nèi)容類型:使用AFNetworking 2.0的text / html我正在嘗試AFNetworking的新版本2.0,我收到了上面的錯(cuò)誤。知道為什么會(huì)這樣嗎?這是我的代碼:    NSURL *URL = [NSURL URLWithString:kJSONlink];     NSURLRequest *request = [NSURLRequest requestWithURL:URL];     AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request];     op.responseSerializer = [AFJSONResponseSerializer serializer];     [op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {         NSLog(@"JSON: %@", responseObject);     } failure:^(AFHTTPRequestOperation *operation, NSError *error) {         NSLog(@"Error: %@", error);     }];     [[NSOperationQueue mainQueue] addOperation:op];我正在使用Xcode 5.0。此外,這是錯(cuò)誤消息:Error: Error Domain=AFNetworkingErrorDomain Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo=0xda2e670 {NSErrorFailingURLKey=kJSONlink, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0xda35180> { URL: kJSONlink } { status code: 200, headers {     Connection = "Keep-Alive";     "Content-Encoding" = gzip;     "Content-Length" = 2898;     "Content-Type" = "text/html";     Date = "Tue, 01 Oct 2013 10:59:45 GMT";     "Keep-Alive" = "timeout=5, max=100";     Server = Apache;     Vary = "Accept-Encoding";} }, NSLocalizedDescription=Request failed: unacceptable content-type: text/html}我只是使用kJSONlink隱藏了JSON。這應(yīng)該返回一個(gè)JSON。
查看完整描述

3 回答

?
陪伴而非守候

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超8個(gè)贊

這意味著您的服務(wù)器正在發(fā)送"text/html"而不是已經(jīng)支持的類型。我的解決辦法是添加"text/html"acceptableContentTypes在設(shè)置AFURLResponseSerialization類。只需搜索“acceptableContentTypes”并@"text/html"手動(dòng)添加到集合中。

當(dāng)然,理想的解決方案是更改從服務(wù)器發(fā)送的類型,但為此您將不得不與服務(wù)器團(tuán)隊(duì)交談。


查看完整回答
反對(duì) 回復(fù) 2019-08-29
?
慕村9548890

TA貢獻(xiàn)1884條經(jīng)驗(yàn) 獲得超4個(gè)贊

我將@jaytrixz的答案/評(píng)論更進(jìn)一步,并將“text / html”添加到現(xiàn)有的類型集中。這樣當(dāng)他們將它在服務(wù)器端修復(fù)為“application / json”或“text / json”時(shí),我聲稱它將無縫地工作。

  manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
查看完整回答
反對(duì) 回復(fù) 2019-08-29
  • 3 回答
  • 0 關(guān)注
  • 745 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)