Facebook login using FBloginView not showing up in ios 6

I am trying to create a login button for Facebook using FBloginView. Below 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 the login button is not displayed. what is the problem with my code. in the console I get "Recorded".

+4
source share
2 answers

I added FacebookSDKResources.bundle, but still I got the error message "Unknown FBLoginView class in interface builder" that appears in the xcode output panel.

To fix this, I added the following line to doneFinishLaunchingWithOptions:

[FBLoginView class];

This is explained at https://developers.facebook.com/ios/login-ui-control/

+6
source

, , FacebookSDKResources.bundle.

+4

All Articles