purplecabbage / phonegap-plugins

Plugins for use with PhoneGap.
972 stars 3.82k forks source link

ChildBrowser - IOS 1.5 *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> Application tried to present modally an active controller <MainViewCont #89

Open Ruddiger opened 12 years ago

Ruddiger commented 12 years ago

This happend in IOS because it won't let you re-add a modal item and subsequent calls to showWebPage try to recall the childBrowser. A quick fix is to do the following in showWebPage (ChildBrowserCommand.m):

#ifdef CORDOVA_FRAMEWORK
    CDVViewController* cont = (CDVViewController*)[ super viewController ];
    childBrowser.supportedOrientations = cont.supportedOrientations;
    childBrowser.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    @try {
        [ cont presentModalViewController:childBrowser animated:YES ];
    }@catch(NSException * e){
        NSLog(@"ALready visible");
    }
#endif