Re: [問題] 有人在用ASIHTTPRequest嗎?
※ 引述《takuro1026 (呆牙)》之銘言:
: ※ 引述《Gsus (肉元,吉米,助教)》之銘言:
: : 我是用[request startAsychronous]來取得json
: : 照理來說會在requestFinished:(ASIHTTPRequest *)request {...}
: : 中可取得request.responseString & request.responseData
: : 通常是直接取得request.responseString用json parser轉乘cocoa object
: : 但是現在都只得到空字串與空data
: : 而在request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data {...}
: : 中有data,用[[NSString alloc] initWithData] print出來確實可以看到json
: : 另我不解的是為什麼會跑到receivedData那邊去
: : 而且更不解為什麼request.responseData卻沒東西...
: : 以前我也是這樣用沒問題說...
: 最近剛好有用到
: 在requestFinished裡
: 透過[resquest responseString];
: 可以取得NSString
: 這幾天這樣用都是OK的
知道為什麼了
在這邊po一下以免之後有人有相同問題
文件上是這樣說的:
"If you need to process the response as it comes in
(for example, you want to use a streaming parser to
parse the response while it is still being downloaded),
have your delegate implement request:didReceiveData:
(see ASIHTTPRequestDelegate.h.
Note that when you do this, ASIHTTPRequest will not populate
responseData or write the response to downloadDestinationPath -
you must store the response yourself if you need to."
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.248.16.151
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章