如何使用Facebook Graph API for iPhone发布给朋友Wall

iPr*_*abu 5 facebook-graph-api ios facebook-ios-sdk

我想在用户朋友的墙上贴一些东西.

我用它来发布到用户墙

SBJSON *jsonWriter = [[SBJSON new] autorelease];

    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                                                           @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];

    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                                @"a long run", @"name",
                                @"The Facebook Running app", @"caption",
                                @"it is fun", @"description",
                                @"http://itsti.me/", @"href", nil];
    NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"Share on Facebook",  @"user_message_prompt",
                                   actionLinksStr, @"action_links",
                                   attachmentStr, @"attachment",nil];

    [facebook dialog:@"feed"
            andParams:params
          andDelegate:self];
Run Code Online (Sandbox Code Playgroud)

但我需要在朋友的墙上张贴.我怎样才能做到这一点

在这篇文章中,他们提到了targetId我是否必须对此做些什么.

Kin*_*iss 3

你有没有尝试过使用,

[facebook requestWithGraphPath:@"[friend_ID]/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];
Run Code Online (Sandbox Code Playgroud)

更新:

Graph API 将不再支持在朋友墙上发帖。相反,您必须使用 FBDialog。