Well, so far I have an application that makes a Post to the Facebook Wall, through the Social library included at iOS, but it makes a dialog box expecting the User to confirm it or cancel, however I would like to know if it´s possible doing a direct post to the Facebook User Wall, without using the Facebook SDK. The code I have it´s the next:
#import <Social/Social.h>
#import <Accounts/Accounts.h>
@interface eFViewController ()
@end
@implementation eFViewController
- (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)oprimir:(id)sender {
SLComposeViewController *controladorSocial;
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])//check if Facebook Account is linked
{
controladorSocial=[[SLComposeViewController alloc]init];
controladorSocial=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; //Tell him what social plattform to use it, e.g. facebook or twitter
[controladorSocial setInitialText:@"sd"];
[self presentViewController:controladorSocial animated:YES completion:nil];
}
[controladorSocial setCompletionHandler:^(SLComposeViewControllerResult result){
NSString *output;
switch(result){
case SLComposeViewControllerResultCancelled:
output=@"Cancelado";
break;
case SLComposeViewControllerResultDone:
output=@"Trivia social posteada";
break;
default:
break;
}
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
}];
}
@end