2017-01-05 15 views
0

我想在swift3中使用iOS iOS facebook SDK共享Facebook中的內容。 我已經在我的xXode項目中安裝了pod,並鏈接到了facebook開發者以及.plist文件中的所有設置,但它對我無效。如何在Swift 3中使用FacebookSDK共享文本,鏈接和圖像

這是我已經安裝了三個艙:

1. pod 'FacebookCore' 
2. pod 'FacebookLogin' 
3. pod 'FacebookShare' 

Facebook登錄按鈕適當的工作,但在Facebook上分享不,

這是我使用的代碼:

var content = LinkShareContent(url: URL(string: "https://newsroom.fb.com/")!, 
            title: "Name: Facebook News Room", 
            description: "Description: The Facebook Swift SDK helps you develop Facebook integrated iOS apps.", 
            imageURL: URL(string: "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png")) 


    content.placeId = "166793820034304" 

    showShareDialog(content, mode: .web) 
+0

你能告訴我們代碼嗎,你如何準備要共享的內容? – dirtydanee

+0

你確定我更新了我的問題 –

+0

你是否完成了開發者平臺上聲明的所有'先決條件'? – dirtydanee

回答

2

導入社會

let vc = SLComposeViewController(forServiceType:SLServiceTypeFacebook) 
vc?.add(UIImage.image) 

vc?.add(URL(string: "http://www.example.com/")) 

vc?.setInitialText("Initial text here.") 

self.present(vc!, animated: true, completion: nil) 
+1

SLComposeViewController在IOS 11中已被棄用 –

相關問題