Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS- Fackbook- FBLoginView does not show Login Button like HelloFacebookSample does

It is not redundancy question! My problems is very similar with facebook login using FBloginView not showing in ios 6 But it is not same!

I have tried migrating HelloFacebookSample code into my project. I have carefully checked and compared both codes. There is no critical difference.

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    FBLoginView *loginView = [[FBLoginView alloc] init];
    loginView.frame = CGRectOffset(loginView.frame, 45, 45);
    loginView.delegate = self;
    [self.view addSubview:loginView];
    [loginView sizeToFit];
}

And delegate

#pragma mark - FBLoginViewDelegate

- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
    self.facebookLogInButton.enabled = YES;
}

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
                            user:(id<FBGraphUser>)user {
    
    self.labelFirstName.text = [NSString stringWithFormat:@"Hello %@!", user.first_name];
    self.profilePic.profileID = user.id;
    self.loggedInUser = user;
}

- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
    BOOL canShareAnyhow = [FBNativeDialogs canPresentShareDialogWithSession:nil];
    self.facebookLogInButton.enabled = canShareAnyhow;
    self.profilePic.profileID = nil;
    self.labelFirstName.text = nil;
    self.loggedInUser = nil;
}

The App CAN run on simulator, but I can't see the facebook's blue login button.

I have re-imported FacebookSDK.framework, FacebookSDKResources.bundle, and so on. Exactly same with the sample code. It still does not show the Facebook Login Button.

Anyone had and solved this kind problem?

EDIT- I found some new trail

warning: skipping file '/Users/Digiflex/Dropbox/Dev/XxxxXxxx Project/XxxxXxxx/../../Facebook API SDK/FacebookSDK/FacebookSDK.framework/Versions/A/Resources/FacebookSDKResources.bundle'

Any idea?

(unexpected file type 'wrapper.plug-in' in Frameworks & Libraries build phase)

like image 284
Yi Jiang Avatar asked Feb 28 '13 15:02

Yi Jiang


1 Answers

I have come across the same problem and here's the solution I found:

DO NOT DO THIS: Don't add the FacebookSDKResources.bundle as a framework (as I did), by going to the Project Editor, selecting your Target, selecting the Summary tab and then hitting the '+' button on the Linked Frameworks and Libraries list.

Don't do this

DO THIS INSTEAD: Add the FacebookSDKResources.bundle as a Resource (because that's actually what it is). To do this:

  1. Go to the Project Editor
  2. Select your Target
  3. Go to the Build Phases tab
  4. Expand the Copy Bundle Resources List and hit the '+' button on the bottom
  5. On the following prompt, click on 'Add Other...'
  6. Find the FacebookSDKResources.bundle and hit 'Open'
  7. You can choose to copy the resources to your project's folder. In my opinion, that's not really necessary.

Do this instead

OBS: I'm not sure this really solves the issue with the Facebook login button you were experiencing, because I'm not using this button in the particular project I'm working on. However, I believe it should work.

like image 200
Bell App Lab Avatar answered Nov 08 '22 08:11

Bell App Lab