获取错误:HTTP状态代码:403尝试发布到Facebook朋友墙

时间:2013-02-22 16:55:37

标签: cocoa-touch facebook-graph-api

这是我的代码:

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               appId, @"app_id",
                               link, @"link",
                               picture, @"picture",
                               NSLocalizedString(@"_findFriends_inviteFriend_title", @""), @"name",
                               NSLocalizedString(@"_findFriends_inviteFriend_description", @""), @"description",
                               NSLocalizedString(@"_findFriends_inviteFriend_message", @""),  @"message",
                               nil];
NSString * graphPath = [NSString stringWithFormat:@"%@/feed", friendId];

PF_FBRequest * request = [[PF_FBRequest alloc] initWithSession:[PFFacebookUtils session] graphPath:graphPath parameters:params HTTPMethod:@"POST"];

PF_FBRequestConnection *newConnection = [[PF_FBRequestConnection alloc] init];

[newConnection addRequest:request completionHandler:nil];

[newConnection start];

在此之前,我检查用户是否获得了权限:

if ([PF_FBSession.activeSession.permissions indexOfObject:@"publish_stream"] == NSNotFound)
{
    [PFFacebookUtils reauthorizeUser:[PFUser currentUser]
              withPublishPermissions:@[@"publish_stream"]
                            audience:PF_FBSessionDefaultAudienceFriends
                               block:^(BOOL succeeded, NSError *error) {
                                   if (succeeded)
                                   {
                                       [self postOnWall:indexPath];
                                   }
                                   else{
                                       //
                                   }
                               }];
    return;
}

[self postOnWall:indexPath];

问题是我得到错误:HTTP状态代码:403

0 个答案:

没有答案