繁体   English   中英

在iOS Swift中将FBSDKCore更新为5.6.0后,'ViewController'与协议'SharingDelegate'的冗余一致性

[英]Redundant conformance of 'ViewController' to protocol 'SharingDelegate' after updating the FBSDKCore to 5.6.0 in iOS Swift

目前,我正在迅速开发iOS应用程序。 在我的应用程序中,我使用FacebookShare pod(FBSDKCoreKit 4.46.0)将内容共享到Facebook。 为此,我使用了FBSDKSharingDelegate。 今天,我将Pod的FBSDKCoreKit更新为5.6.0。 更新后,我在代码中得到了一些建议,例如

“ FBSDKSharingDelegate”已重命名为“ SharingDelegate”

所以我将其更改为SharingDelegate,代码也进行了更改。 但是现在它显示了另一个错误,

“ ProductDetailViewController”与协议“ SharingDelegate”的冗余一致性

我在Google中搜索,但没有任何解决方案。 请帮我。

这些是我在该ViewController类中使用的协议

class customViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, MFMailComposeViewControllerDelegate, UIGestureRecognizerDelegate, UITextViewDelegate, UIScrollViewDelegate, GADBannerViewDelegate, SharingDelegate 
{

}

我不知道哪个协议与SharingDelegate冗余。

根据Facebook文档 ,当前版本中的SharingDelegate协议只有三个功能:

func sharer(_ sharer: Sharing, didCompleteWithResults results: [String : Any]) {

}

func sharer(_ sharer: Sharing, didFailWithError error: Error) {

}

func sharerDidCancel(_ sharer: Sharing) {

}

您的其他协议都不会覆盖任何这些功能,因此您的问题不会在这里发生。

您可能具有也实现此协议的扩展,我可以重现以下错误:

class FBTestViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, MFMailComposeViewControllerDelegate, UIGestureRecognizerDelegate, UITextViewDelegate, UIScrollViewDelegate, GADBannerViewDelegate, SharingDelegate {

}

extension UIViewController: SharingDelegate {

}

输出:

“ FBTestViewController”与协议“ SharingDelegate”的冗余一致性

在您的项目中搜索那些SharingDelegate实现(可能在扩展中)并将其删除。

暂无
暂无

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

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