簡體   English   中英

如何在您的Facebook牆上帖子中標記朋友……?

[英]How to tag friends in your Facebook wall post…?

我正在嘗試在我的留言牆上標記一些朋友,並且正在發送以下參數,但是此留言將我提供的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];

任何幫助表示贊賞...

要標記處於ur 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];
        }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM