gpt4 book ai didi

objective-c - iOS 5 : WebKit discarded an uncaught exception 中的新错误

转载 作者:可可西里 更新时间:2023-11-01 03:25:26 25 4
gpt4 key购买 nike

我正在尝试使用 Facebook OAuth 授权 URL 加载 UIWebView,并且我正在使用以下代码。当我的 UIWebView 加载 Facebook 登录页面时,我输入我的凭据,然后按“登录”按钮。当我按下按钮时,出现以下错误:

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 中不起作用。我不明白这个问题,任何人都可以帮助我吗?

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)..我发现这修复了它:

-(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];
}
}

关于objective-c - iOS 5 : WebKit discarded an uncaught exception 中的新错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7812061/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com