Ios FaceBook登录不符合我的需要
我正在创建一个用于执行Facebook登录的应用程序。我正在我的应用程序中使用故事板。Facebook登录是工作,当我点击FBLoginView,然后登录是执行。确认屏幕显示,但当我点击ok按钮,然后我返回登录页面,但我想进入我的主页。在AppDelegate中,我存储用户的数据并使用以下代码:Ios FaceBook登录不符合我的需要,ios,iphone,Ios,Iphone,我正在创建一个用于执行Facebook登录的应用程序。我正在我的应用程序中使用故事板。Facebook登录是工作,当我点击FBLoginView,然后登录是执行。确认屏幕显示,但当我点击ok按钮,然后我返回登录页面,但我想进入我的主页。在AppDelegate中,我存储用户的数据并使用以下代码: - (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user { AppDeleg
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
AppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
appDelegate.firstName = user.first_name;
appDelegate.LastName = user.last_name;
appDelegate.emailID = [user objectForKey:@"email"];
NSMutableArray *data = [NSMutableArray array];
[data addObject:appDelegate.firstName];
[data addObject:appDelegate.LastName];
[data addObject:appDelegate.emailID];
[FBSession.activeSession closeAndClearTokenInformation];
[self didMoveToParentViewController:home];
[self.navigationController pushViewController:home animated:YES];
}
home是HomeViewController的对象。
如何转到HomeViewController页面
现在自定义按钮代码是:
- (IBAction)fblogging:(id)sender {
NSArray *permissions = @[@"email",@"user_about_me",@"user_status",@"user_location"];
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
if (error) {
} else if (FB_ISSESSIONOPENWITHSTATE(status)) {
[[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
if (error) {
NSLog(@"error:%@",error);
}
else
{
NSString *email=[user objectForKey:@"email"];
if (email.length>0) {
email=[user objectForKey:@"email"];
}
else
{
email=@"";
}
NSString *userUpdate =[NSString stringWithFormat:@"user_id=%@&fname=%@&lname=%@",email,user.first_name,user.last_name,nil];
NSLog(@" RequestString for get login details: %@",userUpdate);
// here add ur segue or push view method
[self.navigationController pushViewController:home animated:YES];
}
}];
// [self promptUserWithAccountName]; // a custom method - see below:
}
}];
}
在此处输入代码如果您使用登录视图,它将出现在同一视图中,使用自定义按钮它将重定向到页面您需要的任何内容如果您使用自定义按钮使用此我这样做,但它将返回登录页面,我的故事板或代码中是否有任何错误需要删除?您能告诉我吗?在loginview或自定义按钮方法中,我使用哪种方法编写[self.navigationController pushViewController:home animated:YES];