Reputation: 111
i am trying to add facebook share dialog into my ios application and i found the official page from facebook on how to do it, but i run into a problem about ContentProtocol. i dont know what that is. here is the link to the guidence that i use . it is pretty straight forward. basically just install the pod facebookshare, import it and add few line of code, but i got problem on 'myContent'
here is the code import FacebookShare
let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .Native
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
// Handle share results
}
try shareDialog.show()
here is the link https://developers.facebook.com/docs/swift/sharing/share-dialog
what should i put in the myContent?
Upvotes: 0
Views: 175
Reputation: 25
you can use FBSDKShareLinkContent
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "//URL")
content.contentTitle = "MyApp"
content.contentDescription = "//Desc"
content.imageURL = NSURL(string:"//Image URL")
Upvotes: 0
Reputation: 1770
I guess next link is explained what you can use as content and how to use it Content-types
(From documentation) Currently, the Facebook SDK for Swift can share 4 different kinds of content
:
LinkShareContent
object. PhotoShareContent
object. VideoShareContent
object. OpenGraphShareContent
object. Upvotes: 1