简体   繁体   English

如果我不使用classForCoder,iOS Swift的Facebook登录按钮将不会显示

[英]iOS swift facebook login button is not showing up if i don't use classForCoder

I am trying to integrate Facebook single sign on to one of my iOS application. 我正在尝试将Facebook单点登录集成到我的iOS应用程序之一。 I have followed the instructions from Facebook and when i try to run the application i am getting the following error 我遵循了Facebook的指示,当我尝试运行该应用程序时,出现以下错误

Unknown class FBSDKLoginButton in Interface Builder file.

After searching on web, i found that adding the following code will resolve the issue. 在网上搜索后,我发现添加以下代码可以解决该问题。

FBSDKLoginButton.classForCoder()

My question is, what is the significant of this code? 我的问题是,此代码的重要意义是什么? What does this perform behind the scene? 这在后台执行什么操作?

From Apple's Foundation Framework Reference : 苹果的基金会框架参考

classForCoder is a property Overridden by subclasses to substitute a class other than its own during coding. (read-only) classForCoderOverridden by subclasses to substitute a class other than its own during coding. (read-only) Overridden by subclasses to substitute a class other than its own during coding. (read-only)

This method is invoked by NSCoder. NSObject's implementation returns the receiver's class. The private subclasses of a class cluster substitute the name of their public superclass when being archived.

Declaration : 声明书

var classForCoder: AnyClass { get }

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

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