如何从iOS应用发送添加好友请求(给Facebook用户)? [英] How to send add friend request (to facebook user) from iOS application?

查看:172
本文介绍了如何从iOS应用发送添加好友请求(给Facebook用户)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个话题有很多问题,但没有一个有令人满意的答案。再次,我对帮助不是很有信心,因为我最近3个问题中的2个没有得到答复。好的,马的问题是,有没有办法,我们可以向一个iOS应用程序的任何Facebook用户发送朋友请求?当然,我们有该用户的用户ID。



由于我已经google了很多,经历了许多链接,包括


  1. 如何通过iPhone应用程序向Facebook发送朋友请求?

  2. 可以从我自己的应用程序发送Facebook的朋友请求吗?

  3. https://developers.facebook.com/docs/reference/dialogs/requests/

    etc ..

最后我发现了:



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



此对话框做同样的我想要的。那么在图中有什么等同的。或者在iOS sdk中的某些东西, FBDialogueDelegate 。任何可以帮助我的事情。

解决方案

对于 user-to-user 请求,你可以这样做(使用ARC):

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

对于 app-to-user 请求,您可以这样做:

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

确保您拥有正确的访问令牌和正确的Facebook配置(画布页面设置等)每个。


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.

解决方案

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.

这篇关于如何从iOS应用发送添加好友请求(给Facebook用户)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆