如何知道NSURLRequest何时完成加载

即时通讯实施一个应用程序,显示一些Twitter数据,当工作在WiFi是好的,但在3克崩溃,我得出的结论是,因为NSURLRequest获取填充表的数据需要较长的时间加载,所以表结束为键调用一个对象,当键甚至没有加载时,

所以问题是, – 我怎么知道什么时候NSURLRequest完成加载? [我检查了类参考,但没有看到它?]

非常感谢!

委托方法在请求的相应NSURLConnection上调用,例如

urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES]; 

然后您将收到各种callback,包括完成的callback,如下所示:

 - (void)connectionDidFinishLoading:(NSURLConnection *)connection{} 

其他代表callback是:

 - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { - (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection{ - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { 
Interesting Posts