Validate a URL string in my iphone app
        Posted  
        
            by Derek
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Derek
        
        
        
        Published on 2010-04-01T02:48:36Z
        Indexed on 
            2010/04/01
            2:53 UTC
        
        
        Read the original article
        Hit count: 350
        
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
}
© Stack Overflow or respective owner