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".
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With