uiwebviewdelegate

New error in iOS 5: WebKit discarded an uncaught exception

我的梦境 提交于 2019-12-03 03:18:33
I am trying to load a UIWebView with the Facebook OAuth authorization URL and I am using the following code. When my UIWebView loads with Facebook login page, I enter my credentials, then press the "Log in" button. When I hit the button I am getting the following error: WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener:delegate: Application tried to present modally an active controller . This same code works fine with iOS 4.3 and previous versions, but it doesn't work in iOS 5.0. I don't understand the problem, can anyone

objective c open links from UIWebView in safari

跟風遠走 提交于 2019-12-02 18:08:13
问题 I have a UIViewController subclass which includes a UIWebView and implements the UIWebViewDelegate. What i want to do is make links pressed in the UIWebView to open in safari. I've read past questions about this, but still can't make it work. Here is about what i've done: In the - (void)viewDidLoad method of my class i use the following code: [[self articleWebView] setDelegate: self]; [articleWebView loadRequest:requestObj]; I don't want to display the whole html page that is loaded in the

objective c open links from UIWebView in safari

丶灬走出姿态 提交于 2019-12-02 10:37:55
I have a UIViewController subclass which includes a UIWebView and implements the UIWebViewDelegate. What i want to do is make links pressed in the UIWebView to open in safari. I've read past questions about this, but still can't make it work. Here is about what i've done: In the - (void)viewDidLoad method of my class i use the following code: [[self articleWebView] setDelegate: self]; [articleWebView loadRequest:requestObj]; I don't want to display the whole html page that is loaded in the articleWebView object, so in the -(void)webViewDidFinishLoad:(UIWebView *)webView method i use this:

How to detect when a UIWebView has completely finished loading?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 11:18:05
I am trying to build a filter for a UIWebView and I am struggiling to detect when the UIWebView has completely finished loading. I have used the following two methods – webView:shouldStartLoadWithRequest:navigationType: – webViewDidFinishLoad: but the issue is that these will be called multiple times when a page has frames and additional content to load. What I need is to know when the view has completely loaded and there is no more content to fetch. Then when the content has loaded I can check to URL of the page against a list of approved URLS. ANy ideas? Use the UIWebViewDelegate protocol

set a delegate for UIWebView

萝らか妹 提交于 2019-11-30 08:49:56
How do I set a delegate for my UIWebView to use webViewDidFinishLoad ? Matthew Frederick In the interface file indicate that you're interested: @interface SomethingController : UIViewController <UIWebViewDelegate> { Then in your implementation you'll add that delegate method: - (void)webViewDidFinishLoad:(UIWebView *)webView { // Do whatever you want here } Obviously SomethingController should be your actual controller, and UIViewController is whatever you're actually implementing. This, by the way, is basically how you implement any delegate. Edit In a window-based app, assuming your

UIWebView stringByEvaluatingJavaScriptFromString

假装没事ソ 提交于 2019-11-30 02:46:02
I'm stuck on getting some pretty basic JS to run in my UIWebView. In the web view's delegate, I have : - (void)webViewDidFinishLoad:(UIWebView *)wView { NSString *someHTML = [wView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClassName('box')[0]"]; NSString *allHTML = [wView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"]; NSLog(@"someHTML: %@", someHTML); NSLog(@"allHTML: %@", allHTML); } but when the method is invoked, someHTML is nil while allHTML contains the entire body of the HTML in the webview. I've run the JS in the Safari JS console and it works

How to get HTTP headers

别说谁变了你拦得住时间么 提交于 2019-11-30 01:58:09
How do you retrieve all HTTP headers from a NSURLRequest in Objective-C? Harish Saran This falls under the easy, but not obvious class of iPhone programming problems. Worthy of a quick post: The headers for an HTTP connection are included in the NSHTTPURLResponse class. If you have an NSHTTPURLResponse variable you can easily get the headers out as a NSDictionary by sending the allHeaderFields message. For synchronous requests — not recommended, because they block — it’s easy to populate an NSHTTPURLResponse : NSURL *url = [NSURL URLWithString:@"http://www.mobileorchard.com"]; NSURLRequest

How to load a url link that is inside a web view and keep it in that web view in SWIFT

放肆的年华 提交于 2019-11-29 18:03:49
I have a web view that has a webpage with links at the bottom. I have a way to deal with them being clicked, but all it does is open them into a new safari browser. This is not what I want.I would like for them to stay inside the web view and allow me to navigate them easily like that. Is there a way to do this? I have tried just using a regular web view, but then the links at the bottom will not work. Here is what I have so far: class ViewController: UIViewController, UIWebViewDelegate { @IBOutlet weak var myWebview: UIWebView! @IBOutlet weak var returnButton: UIButton! override func

set a delegate for UIWebView

懵懂的女人 提交于 2019-11-29 12:08:42
问题 How do I set a delegate for my UIWebView to use webViewDidFinishLoad ? 回答1: In the interface file indicate that you're interested: @interface SomethingController : UIViewController <UIWebViewDelegate> { Then in your implementation you'll add that delegate method: - (void)webViewDidFinishLoad:(UIWebView *)webView { // Do whatever you want here } Obviously SomethingController should be your actual controller, and UIViewController is whatever you're actually implementing. This, by the way, is

How to get the url of currently playing video in UIWebview

三世轮回 提交于 2019-11-29 04:06:06
问题 Is there any way to get the link of currently playing video.I am loading m.youtube.com .For some videos it is not even entering the delegates.I tried using a NStimer as well.But for some videos it is not the clicked url 回答1: There is a hacky way of doing it by listening for the AVPlayerItemBecameCurrentNotification notification. This notification is fired when a UIWebView shows the media player, and it sends an AVPlayerItem as the notification's object. For example: [[NSNotificationCenter