Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIWebView Load URL with parameters

Tags:

I have an application that stores the user ID and code in NSUSERDEFAULTS I need to use these values in order to get UIWebView to visit url: www.mywebsite.com/check.php?id=(idhere)&code=(idhere).

I have looked at some other topics but nothing has seemed to help so far.

I'm new to this language so thanks for your patience.

Jack Brown.

like image 212
Jack Brown Avatar asked Dec 16 '12 05:12

Jack Brown


1 Answers

Simplest form:

- (void) viewDidLoad 
{    
    [super viewDidLoad];

    UIWebView *webView = [UIWebView alloc] initWithFrame:self.view.frame];
    [self.view addSubview:webView];
    NSString *url = @"http://google.com?get=something&...";
    NSURL *nsUrl = [NSURL URLWithString:url];
    NSURLRequest *request = [NSURLRequest requestWithURL:nsUrl cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];

    [webView loadRequest:request];
}
like image 101
Karthik Avatar answered Sep 28 '22 08:09

Karthik