I implemented the Twitter Kit SDK and followed all their instructions to share a video to Twitter. Here is the code I have:
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)
}
}
}
}
It triggers the log-in successfully and Im able to compose a tweet, however, oddly, it shares an image from the video as opposed to the actual video. Im confident that the videoURL that I pass through in the parameter is the video URL, because I use that same URL to save the video to the users camera roll.
What could I be doing wrong?