iOS版:连接到Facebook不留授权的应用程序 [英] iOS: Connect to Facebook without leaving the app for authorization

查看:135
本文介绍了iOS版:连接到Facebook不留授权的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,它的图形API之前,是可能的。

I know that it was possible before the Graph API.

我的iPhone应用程序,可能无法在后台(的要求之一)工作。结果
此外,还有对应用的启动登录屏幕。结果
因此,它不适合去背景,以验证在Facebook,然后返回到应用程序,每个用户希望分享一些时间再次登录。

I work on an iPhone app that may not be in the background (one of the requirements).
In addition there is a login screen on the app launching.
Therefore it is not suitable to go to background in order to authenticate to Facebook and then return to the app and login once again each time the user wants to share something.

所以,我的问题是,如果有一种方法,而无需离开应用程序与Facebook进行身份验证。

So, my question is if there is a way to authenticate with Facebook without leaving the app.

顺便说一句,我曾尝试使用旧的API。结果
它的工作的开始,但昨天停止工作。结果
我刚才看到老Facebook登录的Web视图内的空白屏幕。结果
我也检查了我使用旧的Facebook连接API老的应用程序之一,我得到相同的空白登录屏幕在该应用程序了。

BTW, I have tried to use the old API.
It worked in the beginning but yesterday it stopped working.
I just see a blank screen inside the old Facebook login web view.
I have also checked one of my old apps that use that old Facebook Connect API and I get the same blank login screen in that app too.

任何想法将AP preciated。

Any idea will be appreciated.

感谢您提前。

- 结果
迈克尔。

--
Michael.

推荐答案

在Facebook.m

In Facebook.m

- (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth
                    safariAuth:(BOOL)trySafariAuth {
  NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 _appId, @"client_id",
                                 @"user_agent", @"type",
                                 kRedirectURL, @"redirect_uri",
                                 @"touch", @"display",
                                 kSDKVersion, @"sdk",
                                 nil];

方法注释掉

 UIDevice *device = [UIDevice currentDevice];
  if ([device respondsToSelector:@selector(isMultitaskingSupported)] && [device isMultitaskingSupported]) {
    if (tryFBAppAuth) {
      NSString *fbAppUrl = [FBRequest serializeURL:kFBAppAuthURL params:params];
      didOpenOtherApp = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:fbAppUrl]];
    }

    if (trySafariAuth && !didOpenOtherApp) {
      NSString *nextUrl = [NSString stringWithFormat:@"fb%@://authorize", _appId];
      [params setValue:nextUrl forKey:@"redirect_uri"];

      NSString *fbAppUrl = [FBRequest serializeURL:loginDialogURL params:params];
      didOpenOtherApp = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:fbAppUrl]];
    }
  }

这将prevent应用程序无法进入后台,告诉你标准的FB对话框。

This will prevent the app from going to background and show you the standard fb dialog.

这篇关于iOS版:连接到Facebook不留授权的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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