我目前正在关注这个主题:Social Framework iOS 8 swift并且我已经成功地完成了它。
以下是我在Swift中的完整代码:
import Social
和
@IBAction func shareFB(sender : AnyObject) {
if(SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook))
{
var SocialMedia :SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
SocialMedia.completionHandler = {
result -> Void in
var getResult = result as SLComposeViewControllerResult;
switch(getResult.toRaw()) {
case SLComposeViewControllerResult.Cancelled.toRaw(): println("Cancelled")
case SLComposeViewControllerResult.Done.toRaw(): println("It's Work!")
default: println("Error!")
}
self.dismissViewControllerAnimated(true, completion: nil)
}
self.presentViewController(SocialMedia, animated: true, completion: nil)
SocialMedia.setInitialText("Test a Post on Facebook")
}
}
如果我想附加或上传一个视频文件,以便通过社交框架在Facebook上发布,
怎么可能还是不可能?如果不是,我该怎么办?
提前谢谢你的回答。
最佳答案
您只能添加文本、URL和图像。
有关更多信息,请参阅此处的撰写文章部分。
https://developer.apple.com/library/prerelease/ios/documentation/NetworkingInternet/Reference/SLComposeViewController_Class/index.html#//apple_ref/c/tdef/SLComposeViewControllerCompletionHandler
你需要分享的是视频网址。