[英]I have to convert objective c code into swift3.0, I'm getting errors while trying online conversion
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: 我可以在线转换它(编译器只抱怨我没有定义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!) 我在评论中包含了指向在线转换器的链接(实际上我只是留在其中,转换器添加了它!)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.