可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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:
回答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
}