Share and image post in twitter:
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewController *fbPost = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbPost setInitialText:@"Share text"];//YOUR TEXT
[fbPost addImage:[UIImage imageNamed:@"shareImage.png"]];//YOUR IMAGE
[self presentViewController:fbPost animated:YES completion:nil];
[fbPost setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(@"Post Canceled");
break;
case SLComposeViewControllerResultDone:
NSLog(@"Post Sucessful");
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion:nil];
}];
}
No comments:
Post a Comment