Sharing content through Twitter and facebook in ios

Almost Everyone in this world will expect that what others say about our app or our content,Being a mobile application developer how it will be if we integrate a feature to share the app content or features to the social media, would be nice right. Yes.

Here apple gives us a framework to make our work easier to spread our content around the world . Lets toss the coin to decide Twitter or Facebook gets their first place , oh ya Twitter on mark, Please read bit below , you can get the Twitter’s sample code followed by Facebook code snippet . Oh ya you got the code snippets  but i forgot saying the framework to be added to build it without compile error.

We have to add Social framework in your project then paste and modify the below codes in your class where you like spread the content of your app to globe

mySLComposerSheet = [[SLComposeViewController alloc] init];

mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];

[mySLComposerSheet setInitialText:@””];

[mySLComposerSheet addImage:[UIImage imageNamed:@””]];

[self presentViewController:mySLComposerSheet animated:YES completion:nil];

For FaceBook:

mySLComposerSheet = [[SLComposeViewController alloc] init];

mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

[mySLComposerSheet setInitialText:@””];

[mySLComposerSheet addImage:[UIImage imageNamed:@””]];

[self presentViewController:mySLComposerSheet animated:YES completion:nil];

Please post your comments or share my page , if you like/love it

Leave a Reply

Your email address will not be published. Required fields are marked *