Skip to content

Instantly share code, notes, and snippets.

@Adnan1990
Last active June 6, 2016 06:49
Show Gist options
  • Select an option

  • Save Adnan1990/3c4277ca1827e60bdf24 to your computer and use it in GitHub Desktop.

Select an option

Save Adnan1990/3c4277ca1827e60bdf24 to your computer and use it in GitHub Desktop.
Sharing on fb or twitter using social.framework
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
#import <Social/Social.h>
#import "ViewController.h"
@interface ViewController ()
- (IBAction)postToFacebook:(id)sender;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)postToFacebook:(id)sender
{
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"In the Name of Allah ,The most merciful,The most beneficient"];
[self presentViewController:controller animated:YES completion:nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment