iPhone SDK: Check validity of URLs with NSURL not working?

前端 未结 5 2170
心在旅途
心在旅途 2020-12-12 03:52

I\'m trying to check if a given URL is valid and i\'m doing it like this:

- (BOOL)urlIsValid:(NSString *)address {
    NSURL *testURL = [NSURL URLWithString:         


        
5条回答
  •  醉酒成梦
    2020-12-12 04:16

    NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"yourstring"]];
    bool valid = [NSURLConnection canHandleRequest:req];
    

提交回复
热议问题