1
votes

I'm building a Master-Detail App. In the Detail-View a UIWebView displays html-content based on what is selected in the master. Since this html also includes links, I want to open these links in another View (a uiwebview with the possiblity of going back, reloading, etc. - a browser pretty much).

I've set my DetailViewController to be a UIWebViewDelegate in DetailViewController.h

@interface DetailViewController : UIViewController <UISplitViewControllerDelegate, UIWebViewDelegate>

In DetailViewController.m's

- (void)configureView 

(detailHtml is the UIWebView that displays said HTML content) I do

self.detailHtml.delegate = self;

Further on I have the function that gets triggered when a link is clicked

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
    if ( inType == UIWebViewNavigationTypeLinkClicked ) {
        [self.navigationController performSegueWithIdentifier:@"openCustomBrowser" sender:self];
        return NO;
    }
    return YES;
}

Connecting the segue to the detail view controller instead of the navigation controller doesn't work either. The Storyboard: http://s27.postimg.org/9hpgpmf1e/Bildschirmfoto_2014_03_11_um_18_02_19.jpg

I get the following error:

*** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: 
delegate: <NSUnknownKeyException> [<BrowserViewController 0x8a5b120> setValue:forUndefinedKey:]: 
this class is not key value coding-compliant for the key reload.
1

1 Answers

0
votes

I think you need puth inRequest as sender. But why you need create new view controller? You can go back from thats UIWebView with goBack method. Just add corresponding button in toolbar or navigationItem.