Facebook iOS presentRequestsDialogModallyWithSession返回选定的朋友 [英] Facebook iOS presentRequestsDialogModallyWithSession to return selected friends
问题描述
presentRequestsDialogModallyWithSession
但是我也希望我的应用程序知道发送邀请的人..这是可能吗?
是的,绝对可以。
这是获取用户发送邀请的用户列表的方式。
在presentRequestsDialogModallyWithSession中,必须有一个处理程序,如下所示:
处理程序:^(FBWebDialogResult结果,NSURL * resultURL,NSError *错误){
您可以在resultURL变量中获取响应URL的结果。如果您使用这种方法将其转换为字符串
[resultURL parameterString]
/ pre>
你会得到fbconnect的URL,这是这样的:fbconnect:// success?request = 57985658213xxxx& to%5B0%5D = 13xxxxxxx9& to%5B1 %5D = 1000000xxxxxxx3
这里,request =之后的第一个参数是57985658213xxxx&哪个是请求ID,剩余参数由&%5B0%5D =和&%%5B1%5D =是朋友的Facebook id。在这里,我已经邀请了两个人,他们是:13xxxxxxx9,1000000xxxxxxx3
而不是所有的数字,我把xxxxxxx放在上面的id里,因为我不想在stackoverflow中公开显示我的朋友的facebook id;)
I am developing an iOS app and I want to be able to send invitations to my app through facebook, which I managed to do using presentRequestsDialogModallyWithSession
But I also want my app to know to whom the invitations were sent.. Is that possible?
解决方案Yes it is absolutely possible. Here is the way to get the list of user's friends to whom the user has sent invitation.
In presentRequestsDialogModallyWithSession there must be a handler some thing like this:
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
you can get the result of response URL in resultURL variable. If you convert it to string by using this method
[resultURL parameterString]
you will get fbconnect URL, which is something like this: fbconnect://success?request=57985658213xxxx&to%5B0%5D=13xxxxxxx9&to%5B1%5D=1000000xxxxxxx3
here, first parameter after request= is "57985658213xxxx&to" which is request id, and remaining parameters separated by "&to%5B0%5D=" and "&to%5B1%5D=" are friends' facebook id. Here I have sent the invitation to two persons, here are they: 13xxxxxxx9, 1000000xxxxxxx3
Instead of all digits, I have placed xxxxxxx in the above ids because I don't want to show my friends' facebook id publicly here in stackoverflow ;)
这篇关于Facebook iOS presentRequestsDialogModallyWithSession返回选定的朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!