Return to Snippet

Revision: 59433
at September 7, 2012 22:55 by code4mac


Initial Code
- (IBAction)LauchURLAction:(id)sender
{
    
    NSLog(@"***[STARTING] -  open URL in Safari ");
    [self launchURL:@"http://www.someurl.com"];
}



- (void)launchURL:(NSString *) urlToLaunch
{
    NSLog(@"***[STARTING] -  launch url ");
    NSString *urlToOpen = [NSString stringWithFormat:urlToLaunch];
    urlToOpen = [urlToOpen stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
    NSURL *url = [NSURL URLWithString:urlToOpen];
    if (![[UIApplication sharedApplication] openURL:url])
        NSLog(@"%@%@", @"Failed ton open url:",[url description]);
}

Initial URL


Initial Description
simple snippet to open url with an ibaction in safari

Initial Title
(ibaction) Open URL in safari

Initial Tags
url

Initial Language
Objective C