簡體   English   中英

如何在朋友的牆上張貼圖片和文字

[英]How to Post An Image+ Text on friend's wall

我正在嘗試將圖像和文本發布到朋友的牆上。 我不應該使用對話框,而是使用stream.publish直接發布。 我可以成功地將其發布到我自己的牆上(登錄的用戶),但是我需要找到一種在朋友的牆上發布的方法。

這是我的代碼,我需要有人幫助我添加幾行代碼以發布到朋友的牆。

/*
Friends URL To whom's wall I need to post. 
 **I need to figure out how to use friendURL in my code. 
So that post goes to my    friend's wall.
Below code is posting to my own  wall.**

*/ 
NSString *friendURL = [NSString stringWithFormat:
                              @"http://www.facebook.com/profile.php?id=%@",
                              marriedFriend.userID];
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 by Rahul...", @"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];



[facebookRef  requestWithMethodName:@"stream.publish" andParams:params andHttpMethod:@"POST" andDelegate:self];

您似乎正在使用舊的API。 使用更新的Graph API,您可以執行以下操作:

// replace PROFILE_ID with your friend's ID
[facebookRef requestWithGraphPath:@"PROFILE_ID/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

在此處查看更多文檔。

暫無
暫無

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

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