簡體   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