0

我正在尝试在我的墙帖中标记我的一些朋友,并且我正在发送以下参数,但是这个帖子到我的墙我提供的 FB id 没有附加到帖子...

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:

                               @"Test 2  ",@"message",
                               @"100004311843201 , 1039844409", @"to",
                               @"http://www.google.com", @"link",
                               @"Test", @"name",
                               nil];

[self.appDelegate.facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

任何帮助表示赞赏...

4

1 回答 1

0

要在您的 fb 状态中标记朋友..您需要使用 FBFriendPickerViewController 的朋友的“facebook id”和使用 FBPlacePickerViewController 的“place id”。以下代码将为您提供帮助。

  NSString *apiPath = nil;

apiPath = @"me/feed";



if(![self.selectedPlaceID isEqualToString:@""]) {

    [params setObject:_selectedPlaceID forKey:@"place"];

}

NSString *tag  = nil;
if(mSelectedFriends != nil){
    for (NSDictionary *user in mSelectedFriends) {
        tag = [[NSString alloc] initWithFormat:@"%@",[user objectForKey:@"id"] ];

        [tags addObject:tag];

    }

    NSString *friendIdsSeparation=[tags componentsJoinedByString:@","];
    NSString *friendIds = [[NSString alloc] initWithFormat:@"[%@]",friendIdsSeparation ];

    [params setObject:friendIds forKey:@"tags"];
}

FBRequest *request = [[[FBRequest alloc] initWithSession:_fbSession graphPath:apiPath parameters:params HTTPMethod:@"POST"] autorelease];

[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    [SVProgressHUD dismiss];

    if (error) {
        NSLog(@"Error ===== %@",error.description);
        if (_delegate != nil) {
            [_delegate facebookConnectFail:error requestType:FBRequestTypePostOnWall];
        }else{
            NSLog(@"Error ===== %@",error.description);
        }


    }else{

        if (_delegate != nil) {
            [_delegate faceboookConnectSuccess:self requestType:FBRequestTypePostOnWall];
        }
    }
于 2013-06-25T10:53:19.043 回答