Domanda

I am using NSURLSessionDownloadTask to pull down a simple text file from my goDaddy server using the following code:

-(void)getTheInternetFile
//Fire up the downloadTask to pull the file down from my web server.
NSURLSessionDownloadTask *getTheFile = [session downloadTaskWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.myserver.com/utility/file.txt"]] 
completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) 
{
    if(error)
    {
        NSLog(@"Can't do what I want as we have an error %@", [error localizedDescription]);
    }
    else
    {
        NSLog(@"It worked");
    }
    }];

    [getTheInternetFile resume];
}

The problem I am having is that this works really well...sometimes. Other times I get an error message that states: "A server with the specified hostname could not be found".

As the URL is hard coded and never changes, I am at a loss to how this can even happen. Unless goDaddy is letting me down, and the server has all of a sudden become unavailable part of the time, I am at a loss. For what it's worth this just started acting this way today, so maybe it is goDaddy.

È stato utile?

Soluzione

So it turns out it was goDaddy's server having issues, despite their website reporting that there were none. It took 15 minutes on hold to find out that my code is fine.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top