Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

ios - Api Facebook iphone , possible to post to a friend's wall

I want to know if it is possible to post to a friend's wall using the iPhone Facebook api. I have already links explaining how to post on user'wall but not on firend's wall here are the links :

http://www.raywenderlich.com/tag/facebook

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You just have to send your friend's Facebook ID as a parameter under the key "target_id".

OLD SDK: set the FBStream dialog's targetId property.

NEW SDK: set a parameter under the key @"target_id" on the parameters dictionary (when invoking dialog:andParams:andDelegate: on the Facebook object).

Here you have a sample post using the new sdk (the one that uses graph api):

NSMutableDictionary* params = [NSMutableDictionary dictionary];
[params setObject:@"Some text" forKey:@"user_message_prompt"];
[params setObject:@"another text" forKey:@"action_links"];
[params setObject:@"Yet another text" forKey:@"attachment"];
[params setObject:@"SOME FACEBOOK ID" forKey:@"target_id"];

//At some point you need to create the following Facebook instance

[facebook dialog: @"stream.publish"
    andParams: params
    andDelegate: self];

I haven't actually tested this code, but this is a pretty straight-forward thing to once you have already posted a message to your wall.

Hope this helps. Cheers!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...