开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜