gpt4 book ai didi

ios - Facebook 分享行动 Swift

转载 作者:行者123 更新时间:2023-11-30 13:34:03 24 4
gpt4 key购买 nike

我不确定我做错了什么。昨天还可以用,但是今天使用的时候就不行了。下面是代码:

        let facebookShareAction = UIAlertAction(title: "Facebook", style: UIAlertActionStyle.Default) { (action) -> Void in
if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) {
// good to go, let's show the twitter composer
let facebookComposer = SLComposeViewController(forServiceType: ServiceTypeFacebook)
facebookComposer.setInitialText(course.description)
facebookComposer.addImage(course.image)
facebookComposer.addURL(NSURL(string: course.programURL)!)

self.presentViewController(facebookComposer, animated: true, completion: nil)
} else {
// twitter isn't available. alert an error
self.alert("Facebook Unavaiable", msg: "Go to - Settings > Facebook to set up your Facebook account")
}
}

希望有人能帮忙。

最佳答案

服务类型应该是...= SLComposerViewController(forServiceType: SLServiceType....

请尝试以下操作:

    let facebookShareAction = UIAlertAction(title: "Facebook", style: UIAlertActionStyle.Default) { (action) -> Void in
if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) {
// good to go, let's show the twitter composer
let facebookComposer = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
facebookComposer.setInitialText(course.description)
facebookComposer.addImage(course.image)
facebookComposer.addURL(NSURL(string: course.programURL)!)

self.presentViewController(facebookComposer, animated: true, completion: nil)
} else {
// twitter isn't available. alert an error
self.alert("Facebook Unavaiable", msg: "Go to - Settings > Facebook to set up your Facebook account")
}
}

应该可以解决这个问题

关于ios - Facebook 分享行动 Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36282111/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com