我需要分享一些链接的Facebook和Twitter应用程序,如果安装在设备上的按钮tap.I可以共享相同使用WhatsApp(代码如下)。我想知道我是否也可以在Facebook和Twitter应用程序中做同样的事情。如何分享Facebook和Twitter应用程序在Swift 3没有SDK
@IBAction func whatsappbtn(_ sender: UIButton) {
var str = "This is the string which you want to share to WhatsApp"
str=str.addingPercentEncoding(withAllowedCharacters: (NSCharacterSet.urlQueryAllowed))!
let whatsappURL = URL(string: "whatsapp://send?text=\(str)")
if UIApplication.shared.canOpenURL(whatsappURL!) {
if #available(iOS 10.0, *) {
UIApplication.shared.open(whatsappURL!, options: [:], completionHandler: nil)
} else {
// Fallback on earlier versions
}
} else {
self.delegate?.alerting(msg: "Please install Whatsapp and try again.")
}
}
日Thnx,但我需要没有SDK代码。 –