2015-10-06 57 views
0

我升級到Facebook的SDK 4.6和我使用此代碼根據Scruptions示例的應用中實施新的登錄流在Facebook上的APP:Facebook的SDK 4.0的iOS不再快速切換到安裝在設備

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; 
    [login logInWithReadPermissions:@[self.requiredPermission] 
       fromViewController:self 
          handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { 
     if ([result.grantedPermissions containsObject:self.requiredPermission]) { 
      NSLog (@"Sucess!"); 
     } else { 
      [self dismissViewControllerAnimated:YES completion:NULL]; 
     } 
    }]; 

實施此應用程序後,不再快速切換到設備上安裝的Facebook應用程序以請求用戶權限,而是顯示用戶可登錄到Facebook的應用程序內的網頁。

我使用正確的代碼嗎?有沒有辦法讓我進入Facebook應用程序,並讓用戶在3.x SDK中確認權限,因爲用戶已經登錄到Facebook應用程序,並且肯定不會再在我的應用程序中登錄。

+0

請檢查: - http://stackoverflow.com/a/32712246/988169 – pkc456

+0

這是因爲iOS9的。 – WizKid

回答

1
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; 

儘量設置爲login.loginBehavior一個從明年狀態:

typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior) 
{ 
/*! 
    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 
    the device Settings. 
    @note If the account is not available to the app (either not configured by user or 
    as determined by the SDK) this behavior 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, 
}; 
+0

唯一的問題是,在SDK 4.6它不再可能因爲Facebook不希望它:http://stackoverflow.com/questions/32745663/ios-9-facebook-sdk-login-share但你的反應讓我在正確的道路。 –

相關問題