iOS 5中的新错误:WebKit放弃了未捕获的异常 [英] New error in iOS 5: WebKit discarded an uncaught exception

查看:242
本文介绍了iOS 5中的新错误:WebKit放弃了未捕获的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Facebook OAuth授权网址加载 UIWebView ,而且我使用以下代码。当我的 UIWebView 加载Facebook登录页面时,我输入我的凭据,然后按登录按钮。当我点击按钮,我得到以下错误:

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在webView中放弃了一个未捕获的异常:decisionPolicyForNavigationAction:request:frame:decisionListener :delegate:应用程序试图以模态方式呈现活动控制器。

WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener:delegate: Application tried to present modally an active controller .

这个代码适用于iOS 4.3和以前的版本,在iOS 5.0中工作。我不明白问题,任何人都可以帮助我吗?

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 please help me?

NSString *redirectUrlString = @"http://www.facebook.com/connect/login_success.html";
NSString *authFormatString = @"https://graph.facebook.com/oauth/authorize?client_id=%@&redirect_uri=%@&scope=%@&type=user_agent&display=touch";

NSString *urlString = [NSString stringWithFormat:authFormatString, _apiKey, redirectUrlString, _requestedPermissions];
NSURL *url = [NSURL URLWithString:urlString];

NSLog(@"NSURL: %@", urlString);

NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];


推荐答案

您使用的是Ray Wenderlich代码吗? (FBFunLoginDialog)..我发现这修复它:

Are you using the Ray Wenderlich code? (FBFunLoginDialog).. I found that this fixes it:

-(void)checkLoginRequired:(NSString *)urlString {
    NSLog(@"Url: %@",urlString);
    if ([urlString rangeOfString:@"login.php"].location != NSNotFound && [urlString rangeOfString:@"refid"].location == NSNotFound) {
            [_delegate displayRequired];
    } else if ([urlString rangeOfString:@"user_denied"].location != NSNotFound) {
         [_delegate closeTapped];
    }
}

这篇关于iOS 5中的新错误:WebKit放弃了未捕获的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆