A Class help to share video to Facebook & Twitter easily.
Share Video to Twitter is relatively easy than to facebook. Thanks to the uploading media new API.
Just use this class method, and pass your videoData NSData
, the comment for the video NSString
, and Twitter account ACAccount
,and completion block VideoUploadCompletion
for handling the upload complete or fail.
+(void)uploadTwitterVideo:(NSData*)videoData comment:(NSString*)comment account:(ACAccount*)account withCompletion:(VideoUploadCompletion)completion;
If you are not familiar with how to use or get ACAccount
, you can refer to this tutorial about the Social Framework.
You can use this class method to detect whether the use has logged in Twitter account in iOS Settings.
+(BOOL)userHasAccessToTwitter;
Share Video to Facebook is a little bit complicated, because you have to get publish_actions
permission first, and have to submit your app to Facebook for Login Review.
SocialVideoHelper
class did not contain anything about how to get permission. You have to do it by yourself. You can see the detail about how to get permission in Facebook Docs.
Similar to sharing video to Twitter, use this class method.
+(void)uploadFacebookVideo:(NSData*)videoData comment:(NSString*)comment account:(ACAccount*)account withCompletion:(VideoUploadCompletion)completion;
You can use this class method to detect whether the use has logged in Facebook account in iOS Settings.
+(BOOL)userHasAccessToFacebook;
SocialVideoHelper is available under the MIT license. See the LICENSE file for more info.