简体   繁体   English

iOS- Fackbook-FBLoginView不显示HelloFacebookSample之类的登录按钮

[英]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! 我的问题非常类似于facebook登录使用FBloginView没有在ios 6中显示但是它不一样!

I have tried migrating HelloFacebookSample code into my project. 我已经尝试将HelloFacebookSample代码迁移到我的项目中。 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. App CAN可以在模拟器上运行,但我看不到facebook的蓝色登录按钮。

I have re-imported FacebookSDK.framework, FacebookSDKResources.bundle, and so on. 我重新导入了FacebookSDK.framework,FacebookSDKResources.bundle等等。 Exactly same with the sample code. 与示例代码完全相同。 It still does not show the Facebook Login Button. 它仍然没有显示Facebook登录按钮。

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' 警告:跳过文件'/ 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) (框架和库构建阶段中的意外文件类型'wrapper.plug-in')

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. 不要这样做:不要将FacebookSDKResources.bundle添加为框架(就像我一样),转到项目编辑器,选择目标,选择摘要选项卡,然后点击链接框架上的'+'按钮,图书馆清单。

不要这样做

DO THIS INSTEAD: Add the FacebookSDKResources.bundle as a Resource (because that's actually what it is). 做这个INSTEAD:FacebookSDKResources.bundle添加为资源(因为它实际上就是这样)。 To do this: 去做这个:

  1. Go to the Project Editor 转到项目编辑器
  2. Select your Target 选择你的目标
  3. Go to the Build Phases tab 转到Build Phases选项卡
  4. Expand the Copy Bundle Resources List and hit the '+' button on the bottom 展开Copy Bundle Resources List并点击底部的“+”按钮
  5. On the following prompt, click on 'Add Other...' 在以下提示中,单击“添加其他...”
  6. Find the FacebookSDKResources.bundle and hit 'Open' 找到FacebookSDKResources.bundle并点击“打开”
  7. You can choose to copy the resources to your project's folder. 您可以选择将资源复制到项目的文件夹中。 In my opinion, that's not really necessary. 在我看来,这不是必要的。

这样做

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. OBS:我不确定这是否真的解决了您遇到的Facebook登录按钮的问题,因为我没有在我正在处理的特定项目中使用此按钮。 However, I believe it should work. 但是,我相信它应该有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM