0
我希望以異步模式獲取http頭信息(文件大小)。NSNotificationCenter和ASIHTTPRequest
所以我作爲初始化代碼:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(processReadResponseHeaders:) name:@"readResponseHeaders"
object:nil];
我的代碼讀取HTTP頭
-(void)processReadResponseHeaders: (ASIHTTPRequest *)request ;//(id)sender;
{
unsigned long long contentLength = [request contentLength]; //error occurs here
}
它有可能改變ASIHTTPRequest.m
的源代碼我沒加我代碼功能readResponseHeaders通知事件被觸發)
- (void)readResponseHeaders
{
//.........................
[[NSNotificationCenter defaultCenter] postNotificationName:@"readResponseHeaders" object:self];//
}
日誌文件報告:
2010-05-15 13:47:38.034的myapp [2187:6a63] *** - [NSConcreteNotification CONTENTLENGTH]:無法識別的選擇發送到實例0x46e5bb0
歡迎任何評論
感謝 InterDev中
KennyTM 非常感謝:當您發佈的通知,你可以得到ASIHTTPRequest與
object
,如果self
是ASIHTTPRequest – arachide 2010-05-15 09:47:10