0
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"];
4

1 回答 1

1

我在线转换它没有问题(编译器只抱怨我没有定义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")

}

我包含了一个在线转换器的链接作为评论(实际上我只是把它留在里面,转换器添加了它!)

于 2017-03-15T12:14:28.617 回答