The Share Button is Invalid/Disabled
嘿伙计们,
所以我试图在个人应用程序开发中使用Facebook SDK,它使用了swift 3.然而,当我尝试使用Share按钮时,它总是被禁用灰色背景颜色,我不知道应该怎么做我在浏览了Facebook SDK文档和参考资料后进行了更改。
有谁知道如何解决它?以下是我编写分享按钮的方法:
let shareButton = ShareButton(frame: CGRect(x: 50.0, y: 25.0, width: 200, height: 40), content: (LinkShareContent(url: URL(string: "theURLAddress")!)))
view.addSubview(shareButton)
答案 0 :(得分:1)
Objective-C SDK:
将您的Facebook SDK更新为最新版本(v4.x),并使用以下代码:
RecyclerView recyclerViewUser1 = (RecyclerView) rootView.findViewById(R.id.recycler_view_red_room1);
emptyStateTextView = (TextView) rootView.findViewById(R.id.empty_view);
recyclerViewUser1.setEmptyView(emptyStateTextView);
Swift SDK:
使用swift SDK,将以下代码与真实网址一起使用,而不是假网址。
let shareButton = FBSDKShareButton(frame: CGRect(x: 50.0, y: 25.0, width: 200, height: 40))
let content = FBSDKShareLinkContent()
content.contentURL = URL(string: "theURLAddress")
content.quote = "some quote "
shareButton.shareContent = content
self.view.addSubview(shareButton)