Swift:Twitter Kit分享来自视频而非实际视频的图像

时间:2017-08-01 07:10:15

标签: swift twitterkit

我实施了Twitter Kit SDK,并按照他们的所有指示将视频分享到Twitter。这是我的代码:

func shareToTwitter(){

    var composer : TWTRComposerViewController?

    composer = TWTRComposerViewController(initialText: "#metronome", image: nil, videoURL: URL(string: (MainController.sharedInstance.mergedFileClip?.compiledfileURL?.absoluteString)!))

    composer?.delegate = self

    if (Twitter.sharedInstance().sessionStore.hasLoggedInUsers()) {
        // App must have at least one logged-in user to compose a Tweet
        present(composer!, animated: true, completion: nil)
    } else {
        // Log in, and then check again
        Twitter.sharedInstance().logIn { session, error in
            if session != nil { // Log in succeeded
                self.present(composer!, animated: true, completion: nil)
            } else {
                let alert = UIAlertController(title: "No Twitter Accounts Available", message: "You must log in before presenting a composer.", preferredStyle: .alert)
                self.present(alert, animated: false, completion: nil)
            }
        }
    }    
}

它成功触发登录并且我能够编写推文,但奇怪的是,它与视频共享图像而不是实际视频。我确信我在参数中传递的videoURL是视频URL,因为我使用相同的URL将视频保存到用户相机胶卷。

我可能做错了什么?

0 个答案:

没有答案