Daydev
Daydev

Reputation: 11

How can i attach a video file to Publish on Facebook with iOS8 Social Framework Swift

I am currently following this Topic: Social Framework iOS 8 swift and I have successfully finished it.

Here is my complete code in Swift:

import Social

and

@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")
    }


}

If I want to attach or upload a video file to Publish on Facebook by Social Framework, how or not possible? if not What should I do? Thanks in advance for the answers.

Upvotes: 1

Views: 1018

Answers (1)

danielsalare
danielsalare

Reputation: 335

You can only add text, urls and image.

Look on the Compose Post Section here for more information.

https://developer.apple.com/library/prerelease/ios/documentation/NetworkingInternet/Reference/SLComposeViewController_Class/index.html#//apple_ref/c/tdef/SLComposeViewControllerCompletionHandler

What you will have to share is the video url.

Upvotes: 0

Related Questions