[英]Facebook SDK changes to Login in Pop-up view
我正在尝试用Facebook登录我的应用程序。因此我安装了Facebook SDK
。 现在问题是我试图从SDK的SAMPLEs代码开始,即SessionLoginSample
.Problem是,登录它带我到SAFARI
输入credientials.is不可能像PopUP View那样打开登录页面(图2)。 ..
图像1直接进入(SAFARI)..弹出它需要进行多少更改(图像2)。
- (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];
}];
}
}
使用FBConnect看看这个波纹管教程......
iPhone-fbconnect - Facebook的连接教程
看下面的登录对话框......
只需按照说明创建您的ID并使用它..
相同但另一个教程与示例见...
尝试使用UIWebView。 以下链接可能有所帮助
http://www.raywenderlich.com/1488/how-to-use-facebooks-new-graph-api-from-your-iphone-app
您可以将此用于您的会话:
FBSession setActiveSession:[[FBSession alloc]initWithAppID:nil permissions:@[@"email", @"user_friends"] urlSchemeSuffix:@"foo" tokenCacheStrategy:nil]];
更多信息: 开发者Facebook
在文件info.plist中的XCode项目中,使用键“FacebookUrlSchemeSuffix”和字符串值查找或创建行。
试试这个对我来说工作正常::
loginView.loginBehavior=FBSessionLoginBehaviorForcingWebView;
这里loginView是我的FBLoginView。这是你的右侧屏幕截图。
对于屏幕截图1,请使用以下代码:
loginView.loginBehavior=FBSessionLoginBehaviorForcingSafari;
let loginView : FBSDKLoginButton = FBSDKLoginButton()
loginView.loginBehavior = FBSDKLoginBehavior.Web
它适用于我,这是类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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.