Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook iOS presentRequestsDialogModallyWithSession to return selected friends

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?

like image 607
user3370459 Avatar asked Mar 12 '14 16:03

user3370459


1 Answers

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 ;)

like image 97
regeint Avatar answered Sep 20 '22 12:09

regeint