Post on a friend's wall on behalf of a user

前端 未结 2 1272
南旧
南旧 2021-01-25 18:38

I am writing a Facebook application that needs to post on a friend\'s wall on behalf of a user, but out of the scope of a canvas application. I have the following:

相关标签:
2条回答
  • 2021-01-25 19:03

    Use below code for posting on friends wall:

    NSMutableDictionary *paramspost = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                       @"My test app", @"name",
                                       @"http://www.google.com", @"link",
                                       @"FBTestApp app for iPhone!", @"caption",
                                       @"This is a description of my app", @"description",
                                       @"Hello!\n\nThis is a test message\nfrom my test iPhone app!", @"message",
                                       nil];
    
    // Publish.
    // This is the most important method that you call. It does the actual job, the message posting.
    [ facebook requestWithGraphPath:@"100001433267690/feed" andParams:paramspost andHttpMethod:@"POST" andDelegate:self];
    

    where "100001433267690" should be your friends userid in facebook

    0 讨论(0)
  • 2021-01-25 19:13

    Actually, I think I've figured out the answer here. I don't think that there's a way to do it in the new OAuth API, but there does seem to be a way with the older REST API. See the documentation here.

    Simply replace step 2 in my question with the above documentation, still using the OAuth token from step 1, and you should be good :)

    0 讨论(0)
提交回复
热议问题