iOS 发布到 Facebook 发布屏幕在身份验证后不显示



Alrighty。我有一个按钮(下面(,我可以从应用程序中获取一些信息,并将其发布到用户的FB订阅源。

它第一次几乎不起作用。在那之后,它通常会很好地工作。实际情况是,当我按下按钮时,它告诉我已经授予该应用程序使用FB的权限(我只想第一次看到,而不是每次都看到(。然后,当我从那里按"确定"时,它会返回到应用程序,或者会显示我可以实际张贴到墙上的页面(这就是我想要的(。

我正在尝试不同的方法,以使这一点更加一致。这里有什么东西会导致这种行为吗?

-(IBAction)fbButton:(id)sender {
    if (![facebook isSessionValid]) {
        [facebook authorize:permissions];
        [permissions release];
    }
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if ([defaults objectForKey:@"FBAccessTokenKey"] 
        && [defaults objectForKey:@"FBExpirationDateKey"]) {
        facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
        facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
    }
    //Post to Wall
    NSString *poopDollas = [[NSString alloc] initWithFormat:
                         @"sometext $%@!",dollas.text];
    SBJSON *jsonWriter = [[SBJSON new] autorelease];
    // The action links to be shown with the post in the feed
    NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                                                      @"Get Started",@"name",@"http://www.facebook.com/pages/xx/204640386498567",@"link", nil], nil];
    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
    // Dialog parameters
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"DM", @"name",
                                   poopDollas, @"caption",
                                   @"sometext", @"description",
                                   @"http://www.facebook.com/pages/xx/204640386498567", @"link",
                                   @"http://farm8.staticflickr.com/7185/6999841878_e66a8e00fc_t.jpg", @"picture",
                                   actionLinksStr, @"actions",
                                   nil];
    FBDialog *delegate = (FBDialog *)[UIApplication sharedApplication].delegate;
    [facebook dialog:@"feed" andParams:params andDelegate:(id <FBDialogDelegate>)delegate];
}

我取出

[facebook authorize:permissions];
[permissions release];

在第一个IF声明中,我的问题似乎得到了解决。。

最新更新