uiwebviewdelegate

How to handle app URLs in a UIWebView?

流过昼夜 提交于 2019-11-26 18:50:51
问题 I recently found that my UIWebView was choking on ITMS links. Specifically, from the UIWebView in my app, if I navigate to a site such as this one and click the "Available on the App Store" link, UIWebView would error out with "Error Domain=WebKitErrorDomain Code=101 The URL can't be shown." After a bit of Googling, I realized that I needed to catch requests for app links and have iOS handle them. I started out by looking to see if the scheme starts with "itms" in -webView

NSString in UIWebview

倾然丶 夕夏残阳落幕 提交于 2019-11-26 09:29:11
问题 I have an NSString and a webView in my project (Objective-C for iPhone), I have called index.html in webView and inside it I inserted my script (javascript). How can I pass the NSString as a var in my script and viceversa? This is an example, but I don\'t understand it very well. 回答1: Send string to web view: [webView stringByEvaluatingJavaScriptFromString:@"YOUR_JS_CODE_GOES_HERE"]; Send string from web view to Obj-C: Declare that you implement the UIWebViewDelegate protocol (inside the .h

How to delete all cookies of UIWebView?

天大地大妈咪最大 提交于 2019-11-26 06:59:42
问题 In my application, I have a UIWebview that loads linkedin auth page for login. When user logs in, cookies saves into the application. My app has a logout button that is not related to linkedin login. So when user clicks on this button, he logs off from the app. I want that this log off will clear his linkedin cookies also from the app, so that user will log out completely. 回答1: According to this question, you can go through each cookie in the "Cookie Jar" and delete them, like so: