0

我正在制作一个从 plist 下载数据并在 tableview 中使用该数据的应用程序。有没有办法检查与 url 的连接是否成功,然后下载是否成功?或者也许是一个实现类似这样的教程?

谢谢

4

1 回答 1

2

你必须实现这个 NSURLConnection 的委托

//send the request
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

在连接失败的情况下,将执行此方法
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
NSlog(@"no connection");
}

于 2012-04-05T09:13:19.427 回答