How to send add friend request (to facebook user) from iOS application?

≡放荡痞女 提交于 2019-11-27 04:05:24

问题


I know there are lot of questions on this topic but none of those have satisfactory answers. Again I am not so confident about help as 2 of my last 3 questions are unanswered. Well Still, ma question is, Is there any way we can send friend request to any facebook user from one iOS application? Of course we have user id of that user.

As I have googled much and went through many links including

  1. how send friend request to a person in Facebook through iPhone app?
  2. Can a facebook friend request be sent from my own app?
  3. https://developers.facebook.com/docs/reference/dialogs/requests/
    etc..

And finally I found it:

http://www.facebook.com/dialog/friends?id=100002487216939&app_id=123050457758183&redirect_uri=http://www.example.com/response/

This dialog do the same what I want. So is there any equivalent for this in graph. Or something in iOS sdk, FBDialogueDelegate. Any thing that can help me out.


回答1:


For user-to-user requests, you can do this (using ARC):

 NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys: message, @"message", title, @"title", nil];
[[self facebook] dialog: @"apprequests"
                          andParams: [params mutableCopy]
                        andDelegate: delegate];

For app-to-user requests, you can do this:

NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys: message, @"message", nil];
[[self facebook] requestWithGraphPath: @"[FRIEND ID]/apprequests"
                            andParams: [params mutableCopy]
                        andHttpMethod: @"POST"
                          andDelegate: delegate];

Make sure you have the right access tokens and the correct Facebook configuration (canvas page setup etc.) for each.



来源:https://stackoverflow.com/questions/11521580/how-to-send-add-friend-request-to-facebook-user-from-ios-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!