如何在 iOS 应用程序中使用最新的 FBSDK 在不重定向 Safari 浏览器的情况下集成 Facebook [英] How to integrate Facebook without redirect Safari browser in iOS app with latest FBSDK

查看:19
本文介绍了如何在 iOS 应用程序中使用最新的 FBSDK 在不重定向 Safari 浏览器的情况下集成 Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索避免新 facebooksdk 重定向到 safari 的答案.如何在应用程序内打开 facebook 登录视图.如果重定向到 safari 可能会在应用程序商店中拒绝?帮助我.. 提前致谢

解决方案

昨天我使用 FBSDKLoginManager 使用三种 Login with Facebook 将我的应用程序提交到商店,实际上 Facebook 会自动遵循前三个条件

类型 -1

如果用户已经安装了 Facebook 原生应用,则将从应用中检索详细信息.

类型 -2

如果用户没有 Facebook 应用,但他已在设备的设置中登录,则将从这些应用中获取用户详细信息.

类型 -3

如果以上条件都不满足,用户将被自动重定向到 Safari.

类型 -4

 如果以上三个条件都与您无关,请继续下面的代码.

<块引用>

苹果不会拒绝你的应用

目标 C

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];login.loginBehavior=FBSDKLoginBehaviorWeb;//它使用弹出菜单在应用程序内打开

迅捷

var fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()fbLoginManager.loginBehavior = FBSDKLoginBehavior.Native

FBSDKLoginBehavior 类型

typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior){/*!@abstract 尝试通过原生 Facebook 应用登录.如果 Facebook 应用程序是未安装在设备上,回退到 c FBSDKLoginBehaviorBrowser.这是默认行为.*/FBSDKLoginBehaviorNative = 0,/*!@abstract 尝试通过 Safari 浏览器登录*/FBSDKLoginBehaviorBrowser,/*!@abstract 尝试通过当前通过设置"登录的 Facebook 帐户登录.如果没有 Facebook 帐户登录,则回退到 c FBSDKLoginBehaviorNative.*/FBSDKLoginBehaviorSystemAccount,/*!@abstract Attemps 通过模态 c UIWebView 弹出登录@note 此行为仅适用于某些类型的应用程序.请检查脸书用于验证您的应用程序是否符合限制的平台策略.*/FBSDKLoginBehaviorWeb,};

新概念

Hi i am search the answer for avoid new facebooksdk redirect to safari.how to open facebook login view inside the app.if it redirect to safari may reject in app store? help me.. thanks in advance

解决方案

yesterday I submit my app to store using FBSDKLoginManager using three kinds of Login with Facebook , actually Facebook follow the first three conditions automatically

Type -1

if the user already installed the Facebook native app the details will be retrieved from the app.

Type -2

if the user does't have the Facebook app, but he is logged in at the device's Settings, the user details will be taken from those.

Type -3

if none of the condition above is satisfied the user will be automatically redirected to Safari.

Type -4

    if you none of the above three conditions is relevant for you please continue below code.

apple does not reject your app

Objective-C

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior=FBSDKLoginBehaviorWeb;  // it open inside the app using popup menu

Swift

var fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()
fbLoginManager.loginBehavior = FBSDKLoginBehavior.Native

FBSDKLoginBehavior Types

typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior)
{
  /*!
@abstract Attempts log in through the native Facebook app. If the   Facebook app is
not installed on the device, falls back to c  FBSDKLoginBehaviorBrowser. This is the
default behavior.
*/
 FBSDKLoginBehaviorNative = 0,
/*!
@abstract Attempts log in through the Safari browser
  */
FBSDKLoginBehaviorBrowser,
 /*!
  @abstract Attempts log in through the Facebook account currently signed in through Settings.
   If no Facebook account is signed in, falls back to c FBSDKLoginBehaviorNative.
   */
 FBSDKLoginBehaviorSystemAccount,
  /*!
   @abstract Attemps log in through a modal c UIWebView pop up

   @note This behavior is only available to certain types of apps. Please check the Facebook
   Platform Policy to verify your app meets the restrictions.
   */
  FBSDKLoginBehaviorWeb,
   };

the new concept

Facebook SDK for iOSv4.x

(v4.6.0 - September 10, 2015) In addition, the SDK dialogs such as Login, Like, Share Dialogs automatically determine the best UI based on the device, including SFSafariViewController instead of Safari. Follow the our Preparing for iOS 9 guide.

you can get like

这篇关于如何在 iOS 应用程序中使用最新的 FBSDK 在不重定向 Safari 浏览器的情况下集成 Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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