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"];
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!)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.