0
votes

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
1

1 Answers

0
votes

No you can't. It's the way Facebook it set up. Post to a users wall requires a permission. It is built that way to keep people from spamming Facebook. There is a work around though that may help you avoid that popup box. What that pop up dialog is doing is requesting permission to post to the wall at the time of the event. What you could do is request this permission when the app is installed and then set it to auto post when such events are fired but you will have to handle the event when a person declined that permission and request it at the time of the post.