我正在开发一个使用 FB 登录的应用程序。对于从 facebook 登录,我使用的是 FBGraph,如果用户在其帐户中禁用了安全登录,它可以正常工作,但是如果用户启用了安全登录,那么它会给出以下消息..
这是我用于登录的代码
self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:)
andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];
编辑:
根据当前答案的建议,我在我的 FBGraph.m 中添加了以下代码,但是使用此代码,我得到的令牌为零。
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSLog(@"\n\n\nrequest.URL.relativeString = %@\n\n\n",request.URL.relativeString);
if([request.URL.relativeString hasPrefix:@"https://www.facebook.com/connect/login_success.html" ]||[request.URL.relativeString hasPrefix:@"http://www.facebook.com/connect/login_success.html" ]||[request.URL.relativeString hasPrefix:@"http://m.facebook.com/connect/login_success.html" ])
{
[self.webView stopLoading];
[[self.webView superview] removeFromSuperview];
//tell our callback function that we're done logging in :)
if ( (callbackObject != nil) && (callbackSelector != nil) ) {
[callbackObject performSelector:callbackSelector];
}
return NO;
}
return YES;
}
我也变了
self.redirectUri = @"http://www.facebook.com/connect/login_success.html";
到
self.redirectUri = @"http://m.facebook.com/connect/login_success.html";
但是还是没有成功......
请告诉我FB登录的解决方案.....
谢谢...........