ios - 'FBSDKAccessTokenDidChangeNotification' 的 swift 等价物是什么

标签 ios swift facebook

我终于将 Facebook SDK 包装器从 Objective C 迁移到 Swift。 FBSDKAccessTokenDidChangeNotification 的正确替换是什么?

当我尝试使用它时,出现以下错误:

 NotificationCenter.default.addObserver(
       self, 
       selector: #selector(accountChanged(notification:)), 
       name: FBSDKAccessTokenDidChangeNotification,
       object: nil)
 // Use of unresolved identifier 'FBSDKAccessTokenDidChangeNotification'

最佳答案

请参见此处:https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKCoreKit/FBSDKCoreKit/FBSDKAccessToken.h#L36

Swift 中通知的名称是 AccessTokenDidChangeAccessTokenDidChangeNotification,具体取决于您编译的 iOS 版本。

关于ios - 'FBSDKAccessTokenDidChangeNotification' 的 swift 等价物是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58402780/

相关文章:

iphone - 转义 Objective C 中的 @""字符

ios - iOS App 更新期间到底发生了什么?

ios - JSONDecoder - "Expected to decode Dictionary<String, Any> but found a string/data instead."

ios - NSMutableAttributedString 作为 UIAlertAction 的标题 - Swift

google-chrome - FB Connect 与谷歌浏览器无限循环

android - Facebook Graph API 支持搜索人名吗?

ios - iOS 上的 Facebook 分享对话框 : "Publish" button always greyed out

iOS 如何在顶 View Controller 弹出时以编程方式检测?

html - 在网页中间创建响应式表单

ios - 如何以面向协议(protocol)的方式快速将 Layer 添加到 UIButton 子类?