mobile.jugnu
mobile.jugnu

Reputation: 629

Error using NSURLConnection?

I am using following code

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];

and when I run the project get follwing error in

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
   NSLog(@"ERROR with theConenction %@",error);


 }

error is as follows

 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."}

Upvotes: 1

Views: 3530

Answers (2)

Nate Cook
Nate Cook

Reputation: 8585

You might run into this if you are debugging and you have your timeout set low. Try increasing your timeout or run without breakpoints.

Upvotes: 0

Sascha
Sascha

Reputation: 5973

http://newdev.objectified.com/timvaughn/index.php?option=com_objmobadaptor seems to need authentication. Did you implement

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;

? If you don't authenticate, the request will timeout and that causes your error.

Upvotes: 1

Related Questions