Interface Builder文件中未知的FBSDKLoginButton类 [英] Unknown class FBSDKLoginButton in Interface Builder file

查看:172
本文介绍了Interface Builder文件中未知的FBSDKLoginButton类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的全新项目遇到了一个令人沮丧的构建问题。我正在尝试整合Facebook iOS SDK,但由于某些原因,我收到了一些奇怪的错误。当尝试使用FBSDKLoginKit在故事板视图上显示 FBSDKLoginButton



第一个提示是错误的是当我尝试 #import< FBSDKLoginKit / FBSDKLoginKit.h> (但它只在编辑器中显示为错误,仍然编译不正确):/ p>

无法构建模块FBSDKLoginKit。



奇怪的是,这个错误模块相关的构建设置,即使我将它们设置为原始值。



另外有趣的是,如果我明确地引用了 FBSDKLoginButton class从我的视图控制器(例如以编程方式添加按钮),然后基于storyboard的实例化工作正常。所以我猜这是一个链接器的问题,但我承认不是一个专业的人。



没有一个Facebook SDK文档提到这个问题我可以找到,这是奇怪的,因为我说这是一个全新的清洁项目。

解决方案

我的坏,文档 提及此,并建议解决问题,因为我已经知道,通过引用应用程序
didFinishLaunchingWithOptions:
中的 FBSDKLoginButton 类。 (坦白说,在什么地方引用它,无论哪里感觉最舒服,对于我来说,视图控制器更有意义。)

   - (BOOL)应用程序:(UIApplication *)应用程序
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//在应用程序启动后重写自定义点。
[FBSDKLoginButton class];
...
return YES;
}


I am experiencing a very frustrating build issue with my brand new project. I am trying to integrate Facebook iOS SDK, but for some reason I am getting some bizarre errors. When trying to use FBSDKLoginKit to display an FBSDKLoginButton on a storyboard view.

The first hint something is wrong is this "error" when I attempt to #import <FBSDKLoginKit/FBSDKLoginKit.h> (however it only appears as an error in the editor; it still compiles fine):

"Could not build module FBSDKLoginKit."

Strangely, this "error" went away after fiddling with some of the module-related build settings, even when I set them back to their original values.

Also interestingly, if I explicitly reference the FBSDKLoginButton class from my view controller (for example add the button programmatically), then storyboard-based instantiation works fine. So I'm guessing this must be some linker issue or something, but I'm admittedly not a pro at that stuff.

None of the Facebook SDK documentation mentions this issue that I can find, which is bizarre because like I said this is a brand new clean project.

解决方案

My bad, the documentation does mention this, and suggests solving it much as I already figured out, by referencing the FBSDKLoginButton class in application didFinishLaunchingWithOptions:. (Frankly it doesn't matter where you reference it, so wherever feels most comfortable. For me, the view controller makes more sense.)

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    [FBSDKLoginButton class];
    ...
    return YES;
}

这篇关于Interface Builder文件中未知的FBSDKLoginButton类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆