man*_*urt 3 uitableview nsurlrequest ios activity-finish
我正在实现一个显示一些Twitter数据的应用程序,当在wifi上工作时没问题,但是在3g崩溃时,我得出的结论是因为获取填充表的数据的NSURLRequest需要更长的时间来加载所以表结束当键没有加载时调用键的对象,
所以问题是, - 我怎么知道NSURLRequest何时完成加载?[我检查了班级参考,但没看到它??]
非常感谢!
委托方法在请求的相应NSURLConnection上调用,例如
urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
Run Code Online (Sandbox Code Playgroud)
然后,您将收到包含完成的回调的各种回调,如下所示:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection{}
Run Code Online (Sandbox Code Playgroud)
其他代表回调是:
- (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 {
Run Code Online (Sandbox Code Playgroud)