简体   繁体   中英

How to get data from UIWebView pass to Native app in Objective-c IOS

I have a problem. I wanted to get data from webview pass to native application in IOS. I had searched on the internet but I tried manay solution they didn't work for me. My objective is I wanted click on a button in Webview it will remote open the SMS in Native app and set data to body of SMS from Webview. Please help me. Thanks for in advance.

Implement the UIWebviewDelegate method:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

Create a custom URL scheme (do not register it in the plist) that is only intended for communication: bogus-scheme://somedatahere , identify that in the delegate method and return NO but then have your app do whatever it wants, like using the data to open an MFMessageComposeViewController from your app, without having to leave your app.

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