Skip to content

Instantly share code, notes, and snippets.

@ChrisRisner
Created November 13, 2012 07:59
Show Gist options
  • Save ChrisRisner/4064576 to your computer and use it in GitHub Desktop.
Save ChrisRisner/4064576 to your computer and use it in GitHub Desktop.
ios day 15-2
- (IBAction)tappedSendFacebook:(id)sender {
SLComposeViewController *socialComposerSheet;
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
socialComposerSheet = [[SLComposeViewController alloc] init];
socialComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[socialComposerSheet setInitialText:[NSString stringWithFormat:@"My Tweet!",socialComposerSheet.serviceType]];
[self presentViewController:socialComposerSheet animated:YES completion:nil];
}
[socialComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
NSString *output;
switch (result) {
case SLComposeViewControllerResultDone:
//post worked
break;
case SLComposeViewControllerResultCancelled:
//cancelled
break;
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment