[英]How can I get response from UIWebView page to an iOS app?
I'm using UIWebView
as a subview in a UIViewController
. 我使用
UIWebView
作为UIViewController
的子视图。 What this WebView
does is it allows user to submit a form and that form responses as JSON
object. 该
WebView
作用是允许用户提交表单并将表单响应作为JSON
对象。 How can I get this response to an app? 如何获得对应用程序的响应? I'm not able to find what response comes.
我找不到响应。 All I know is that response is
JSON
. 我所知道的是,响应是
JSON
。 I even tried using shouldStartLoadWithRequest()
. 我什至尝试使用
shouldStartLoadWithRequest()
。 But it only shows URL. 但它仅显示URL。 Any help will be appreciated.
任何帮助将不胜感激。
I use the 'window.location'. 我使用“ window.location”。 A little uncomfortable but fine.
有点不舒服但是很好。
You can try implementing this method may be it helps you 您可以尝试实现此方法,可能会有所帮助
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
and check for the navigation types out of these typedef NS_ENUM(NSInteger, UIWebViewNavigationType) { UIWebViewNavigationTypeLinkClicked, UIWebViewNavigationTypeFormSubmitted, UIWebViewNavigationTypeBackForward, UIWebViewNavigationTypeReload, UIWebViewNavigationTypeFormResubmitted, UIWebViewNavigationTypeOther }
并检查导航类型的这些
typedef NS_ENUM(NSInteger, UIWebViewNavigationType) { UIWebViewNavigationTypeLinkClicked, UIWebViewNavigationTypeFormSubmitted, UIWebViewNavigationTypeBackForward, UIWebViewNavigationTypeReload, UIWebViewNavigationTypeFormResubmitted, UIWebViewNavigationTypeOther }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.