post message to users wall [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this questioni am creating a iphone application using Facebook SDK.I want to post message to friends wall.can u help me to implement this..
@sai You can post a message to your friends wall by using the Facebook SDK. You just need to do following task:
- First find your friend's FacebookID (I assume you have it)
- Then do this:
-(void)sendMessageToFriendWall{
NSString* friendID=@"here Please Add Friends FacebookID";
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
friendID, @"to",messageToBePost,@"message",nil];
[[delegate facebook] requestWithGraphPath:[NSString stringWithFormat:@"/%@
/feed",friendID] andParams:params andHttpMethod:@"POST" andDelegate:self];
}
If you don't have your friends's Id, you can find him and his ID using the below method call:
-(void)getFriendsandTheirId{
[delegate.facebook requestWithGraphPath:@"me/friends" andDelegate:self];
}
This will return a json of friends and their facebook IDs. After getting your friend's ID, you can Post on his Wall.
Please don't Forget to Adopt FBRequestDelegate
in your Controller Class.
精彩评论