【发布时间】:2011-07-07 11:22:52
【问题描述】:
我正在使用以下代码
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:listUrl]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:180.0];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
xmlData=[[NSMutableData alloc]init];
当我运行项目时出现以下错误
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"ERROR with theConenction %@",error);
}
错误如下
2011-07-07 16:17:12.343 Tim Vaughn[722:707] ERROR with theConenction Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x1b8b10 {NSErrorFailingURLStringKey=http://newdev.objectified.com/timvaughn/index.php?option=com_objmobadaptor, NSErrorFailingURLKey=http://newdev.xxxxx.com/xxxxxx/index.php?option=com_objmobadaptor, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x1bb610 "The request timed out."}
【问题讨论】:
-
这个错误是因为数据连接不可用。
-
它是否与另一个 URL(例如 apple.com)一起使用?
标签: iphone ipad nsurlconnection