我使用下面的代碼使用NSURLConnection時出錯?
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);
}
錯誤follwing錯誤如下
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."}
此錯誤是因爲數據連接不可用。 – iAmitWagh
它是否與另一個URL(例如apple.com)一起工作? – teriiehina