Check URL validity

后端 未结 3 863
醉梦人生
醉梦人生 2020-12-10 00:34

Can someone confirm that -checkResourceIsReachableAndReturnError: method of NSURL is working as expected. I have tried using it for known URLs and

3条回答
  •  猫巷女王i
    2020-12-10 00:38

    If you just want to know if the URL is valid, you can

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

提交回复
热议问题