Validate a URL string in my iphone app
- by Derek
Hi,
I am getting really frustrated and I cant seem to check if the user has entered a valid url or not. This is what I have tried:
NSString *str = [NSString stringWithFormat:@"%@", [myurl.text stringByAddinPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSURL *aurl = [NSURL URLWithString:urlStr[;
if(aurl == nil){
//Invalid url
}