Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook login using FBloginView not showing in ios 6

Tags:

ios

iphone

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".

like image 676
Rajath Shetty K Avatar asked Dec 27 '22 10:12

Rajath Shetty K


1 Answers

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

To fix this I added the following line to didFinishLaunchingWithOptions :

[FBLoginView class];

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

like image 51
Typo Johnson Avatar answered Jan 18 '23 23:01

Typo Johnson