使用FBloginView的Facebook登录未在iOS 6中显示 [英] facebook login using FBloginView not showing in ios 6

查看:62
本文介绍了使用FBloginView的Facebook登录未在iOS 6中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FBloginView为Facebook创建登录按钮. 以下是我编写的代码.

i am trying create login button for facebook using FBloginView. Following is the code i wrote.

- (void)viewDidLoad
{
[super viewDidLoad];

if(!loginview)
    loginview = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions, user_photos,status_update"]]; // Whatever permissions you need

loginview.frame = self.view.bounds; //whatever you want

loginview.delegate = self;

[self.view addSubview:loginview];
// Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {

NSLog(@"Logged In");

}

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
                        user:(id<FBGraphUser>)user {
NSLog(@"user Id %@",user.id);

}
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
// Called after logout
NSLog(@"Logged out");
}

,但未显示登录按钮. 我的代码有什么问题.在控制台中退出".

but its not showing login button. what is the problem with my code. in console am getting "Logged out".

推荐答案

我添加了FacebookSDKResources.bundle,但在xcode输出窗格中仍然出现错误接口生成器中的未知类FBLoginView".

I had FacebookSDKResources.bundle added but still I got the error "Unknown class FBLoginView in interface builder" appearing in the xcode output pane.

要解决此问题,我在didFinishLaunchingWithOptions中添加了以下行:

To fix this I added the following line to didFinishLaunchingWithOptions :

[FBLoginView class];

这在 https://developers.facebook.com/ios/login中进行了解释-ui-control/

这篇关于使用FBloginView的Facebook登录未在iOS 6中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆