NSURL *contentURL = [[NSURL alloc] initWithString: @"http://en.wikipedia.org/wiki/Facebook"];
NSURL *imageURL = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg"];
button.shareContent = [[FBSDKShareLinkContent alloc]
initWithContentURL: contentURL
contentTitle: @"My Share Title"
contentDescription: @"Lorem ipsum dolor sit amet."
imageURL: imageURL
peopleIDs: @[@"1561082740838259"]
placeID: @"166793820034304"
ref: @"myRefId"];
Asked
Active
Viewed 50 times
0
-
What errors do you get? You need to provide more details to your question. – hering Mar 15 '17 at 13:31
-
Cannot invoke initializer for type 'FBSDKShareLinkContent' with an argument list of type '(contentURL: URL?, contentTitle: String, contentDescription: String, imageURL: URL?, peopleIDs: [String], placeID: String, ref: String) – Teja kvs Mar 15 '17 at 13:32
1 Answers
1
I had no problem converting it online (compiler only complains that I haven't defined FBSDKShareLinkContent:
func dummy(button: UIButton) {
// Converted with Swiftify v1.0.6276 - https://objectivec2swift.com/
var contentURL = URL(string: "http://en.wikipedia.org/wiki/Facebook")
var imageURL = URL(string: "http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg")
button.shareContent = FBSDKShareLinkContent(contentURL: contentURL, contentTitle: "My Share Title", contentDescription: "Lorem ipsum dolor sit amet.", imageURL: imageURL, peopleIDs: ["1561082740838259"], placeID: "166793820034304", ref: "myRefId")
}
I included a link to an online converter as a comment (actually I just left it in, the converter adds it!)

Mozahler
- 4,958
- 6
- 36
- 56
-
Am getting this error ................ Cannot invoke initializer for type 'FBSDKShareLinkContent' with an argument list of type '(contentURL: URL?, contentTitle: String, contentDescription: String, imageURL: URL?, peopleIDs: [String], placeID: String, ref: String)' – Teja kvs Mar 15 '17 at 12:22
-
You are showing me what you sent to FBSDKShareLinkContent, but you haven't told me what it expects for arguments. If it is not your code, CMD-click on FBSDKShareLinkContent and copy and paste the header definition for FBSDKShareLinkContent into your question above. Your arguments (including their type) have to match the expected arguments exactly. It's possible it could be as simple as adding some variation of as NSURL, or you could have mismatched types elsewhere. – Mozahler Mar 15 '17 at 13:33