You need to add Social.framework in your project.
Add --- #import "Social/Social.h"
You can create 3 type of service:
For Facebook -
Add --- #import "Social/Social.h"
You can create 3 type of service:
SLServiceTypeTwitter;
SLServiceTypeFacebook;
SLServiceTypeSinaWeibo;
For Facebook -
SLComposeViewController *facebookController=[SLComposeViewControllercomposeViewControllerForServiceType:SLServiceTypeFacebook];
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResultresult){
[facebookController dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Result Cancelled");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Result Post Done");
}
break;
}};
[facebookController addImage:[UIImage imageNamed:@"yourImage.jpg"]];
[facebookController setInitialText:@"Check out this cool IOS Blog"];
[facebookController addURL:[NSURL URLWithString:@"http://vijaysinghadhikari.blogspot.in/"]];
[facebookController setCompletionHandler:completionHandler];
[self presentViewController: facebookController animated:YES completion:nil];
}
No comments:
Post a Comment