0

好吧,到目前为止,我有一个应用程序可以通过 iOS 中包含的社交库向 Facebook Wall 发布帖子,但它会生成一个对话框,希望用户确认或取消,但我想知道它是否可以在不使用 Facebook SDK 的情况下直接发布到 Facebook 用户墙。我的代码是下一个:

#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
4

1 回答 1

0

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.

于 2014-03-22T23:47:46.970 回答