how to check if url is valid on iphone
i am dow开发者_Go百科nloading a file from URL,but how to check whether URL is working or not??
NSString *durl = [[[NSString alloc] initWithFormat:@"http://xyz/ServicesVersion.aspx"];
durl = [durl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *urla = [[[NSURL alloc] initWithString:durl]autorelease];
but lets say durl is dead ( i mean some garbage value then how to check that)?? // UPDATES
what i meant was how to do URL error handling so that i can switch to my local file if url is showing some error ??
If the string is complete garbage, then NSURL
won't be able to be initialized by it, and will return nil
.
精彩评论