pri*_*ini 6 iphone facebook objective-c ios
嗨,我正在搜索答案,以避免新的facebooksdk重定向到safari.how在app内打开Facebook登录视图.如果它重定向到safari可能会拒绝在应用程序商店?帮助我..提前谢谢
Anb*_*hik 17
昨天我FBSDKLoginManager使用三种Login with 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.
Run Code Online (Sandbox Code Playgroud)
苹果不会拒绝你的应用程序
Objective-C的
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior=FBSDKLoginBehaviorWeb; // it open inside the app using popup menu
Run Code Online (Sandbox Code Playgroud)
迅速
var fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()
fbLoginManager.loginBehavior = FBSDKLoginBehavior.Native
Run Code Online (Sandbox Code Playgroud)
FBSDKLoginBehavior类型
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,
};
Run Code Online (Sandbox Code Playgroud)
新概念
(v4.6.0 - 2015年9月10日)此外,SDK对话框(如Login,Like,Share Dialogs)会根据设备自动确定最佳UI,包括SFSafariViewController而不是Safari.按照我们的准备iOS 9指南.
你可以得到
当您选择登录行为时FBSDKLoginBehaviorWeb,然后打开webView popUp.
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior=FBSDKLoginBehaviorWeb;
Run Code Online (Sandbox Code Playgroud)
PopUp Facebook:

注意:当facebook的行为是,FBSDKLoginBehaviorBrowser它总是在safari浏览器上重定向.将其行为更改为FBSDKLoginBehaviorWeb.
使用此来获取FB SDK的最新更新
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior = FBSDKLoginBehaviorWeb;
NSArray *userdetails;
[login logInWithReadPermissions:userdetails fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error)
{
NSLog(@"Login Error : %@", error.description);
}
else if(result.isCancelled)
{
NSLog(@"Login Cancel By User");
}
else
{
//[self fetchUserDataForFacebookLogin];
//[login logOut];
}
}];
Run Code Online (Sandbox Code Playgroud)