freelixa
freelixa

Reputation: 111

i need help in adding facebook share into my ios application

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

Answers (2)

Hendi Ahmed
Hendi Ahmed

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

vpoltave
vpoltave

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:

  • Links - Represented by the LinkShareContent object.
  • Photos - Represented by the PhotoShareContent object.
  • Videos - Represented by the VideoShareContent object.
  • Open Graph - Represented by the OpenGraphShareContent object.

Upvotes: 1

Related Questions