Facebook SDK changes to Login in Pop-up view

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

I am Trying to Login my app with Facebook.For that reason I have Installed Facebook SDK. now Problem is I am trying to start with SAMPLEs code of SDK i.e SessionLoginSample .Problem is, to login Its takes me to the SAFARI to enter credientials.isn't it possible to open the login Page like PopUP View like(image 2)...

Image 1 is coming directly (SAFARI ) ..what changes required to open it like (image 2) pop up.
 - (IBAction)buttonClickHandler:(id)sender {  SLAppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];   if (appDelegate.session.isOpen) {      [appDelegate.session closeAndClearTokenInformation];  } else {     if (appDelegate.session.state != FBSessionStateCreated) {          appDelegate.session = [[FBSession alloc] init];     }       [appDelegate.session openWithCompletionHandler:^(FBSession *session,                                                       FBSessionState status,                                                       NSError *error) {         // and here we make sure to update our UX according to the new session state         [self updateView];     }]; }   } 

回答1:

Use FBConnect for that see this bellow tutorial...

iPhone-fbconnect-facebook-connect-tutorial

see the Login Dialog like bellow...

Just follow the instruction and create your id and use it..

Same but another tutorial with example see ...

This



回答2:

Try using UIWebView. Following link may help.

http://www.raywenderlich.com/1488/how-to-use-facebooks-new-graph-api-from-your-iphone-app



回答3:

You can use this for your session:

FBSession setActiveSession:[[FBSession alloc]initWithAppID:nil permissions:@[@"email", @"user_friends"] urlSchemeSuffix:@"foo" tokenCacheStrategy:nil]]; 

More information here: Developers Facebook



回答4:

In XCode project in the file info.plist find or create row with key "FacebookUrlSchemeSuffix" and string value.



回答5:

Try this its working fine for me::

loginView.loginBehavior=FBSessionLoginBehaviorForcingWebView; 

Here loginView is my FBLoginView.This is for your right side screen shot.

For Screen shot 1 use following code:

loginView.loginBehavior=FBSessionLoginBehaviorForcingSafari; 


回答6:

  let loginView : FBSDKLoginButton = FBSDKLoginButton()    loginView.loginBehavior = FBSDKLoginBehavior.Web 

It works for me, this is the source code in class FBSDKLoginManager:

public enum FBSDKLoginBehavior : UInt {  /*!  @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.  */ case Native /*!  @abstract Attempts log in through the Safari browser  */ case Browser /*!  @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.  */ case SystemAccount /*!    @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.    */ case Web 

}



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!