ios - 如何在不使用最新 FBSDK 的 iOS 应用程序中将 Safari 浏览器重定向到 Facebook

标签 ios objective-c iphone facebook

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

最佳答案

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

类型-1

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

类型-2

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

类型-3

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

类型-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

FBSDK登录行为类型
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,
   };

新概念

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.



你可以喜欢

enter image description here

关于ios - 如何在不使用最新 FBSDK 的 iOS 应用程序中将 Safari 浏览器重定向到 Facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32438184/

相关文章:

iphone - 用于游戏以外的应用程序的 GameKit

iphone - 将数组保存到包含自定义对象 iPhone 的 Plist 文件

iphone - addSubview 到 View - 显示为 PageCurlDown

ios - UIButton 不触发 touchesbegan

objective-c - cocoa:如何获取工具栏的Tag

iphone - 在 NSTemporaryDirectory 内创建目录

iphone - 在后台无法获取位置更改通知

ios - 使用 Swift 在一个 ViewController 中强制横向模式

ios - 保存一个充满自定义对象的 NSMutableArray

objective-c - 托管对象存储无法创建持久存储协调器