简体   繁体   中英

Pass parameters from custom URL scheme to webview

I'm trying to pass parameters from an IOS custom url to a webview. So far I've implemented the webview in my main viewcontroller, and have implemented a delegate method to grab the params from the inbound URL.

For the second part I used the information provided here: Launching your own application via a custom url scheme

Now. I can see the URL output in the console when I go to the app from safari. How do I then pass that information to the view and the webview?

Thanks.

Maxm, from the app delegate function load your view controller (creating it or performing a segue if needed) and call a function that can pass the param to the web view and load it. something like:

- (void)refreshPageWithUrl:(NSString*)url{
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM