How to integrate Facebook without redirect Safari browser in iOS app with latest FBSDK

前端 未结 6 2268
悲&欢浪女
悲&欢浪女 2020-11-27 21:04

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

6条回答
  •  醉梦人生
    2020-11-27 22:01

    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

提交回复
热议问题