我想在 Facebook 上发布一些东西。我已经习惯SLComposeViewController
了。我只想问如果用户尚未在手机中配置其应用程序,我该如何分享。有什么方法可以在浏览器中打开它然后发布任何内容。考虑我想发布任何字符串说 "hello there" 。所以我保留这个字符串,打开 safari 并在那里登录。在我登录后,字符串会自动发布
if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) {
let fbShare:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
fbShare.completionHandler = {
result in
switch result {
case SLComposeViewControllerResult.Cancelled:
//Code to deal with it being cancelled
break
case SLComposeViewControllerResult.Done:
//Code here to deal with it being completed
break
}
}
refrenceViewController.presentViewController(fbShare, animated: true, completion: nil)
} else {
//open safari and post it there
}