Search code examples
iosobjective-ciphonefacebook-graph-apifacebook-ios-sdk

Facebook SDK. Invite friends to the app


I want to choose one of more friends and send them an invite to my app. I use invitable_friends method of Graph API to get a list of friends, who didn't install my app yet. Then I render my friends in the app UI. User choose friends and tap to send invitations. And here's the problem. I tried to use FBSDKAppInviteDialog, but I couldn't set specific users in its content. And the only one possibility to choose friends is to use facebook dialog, not custom view.

I tried to use FBSDKGameRequestDialog. Its content has a property to to set specific users, but the FBSDKGameRequestDialogDelegate methods are unreachable. And I'm not sure that using game request is the right way to invite friends to use my app.

Older Facebook SDK provided [FBWebDialogs presentRequestsDialogModallyWithSession:message:title:parameters:handler:]. And this worked fine.


Solution

  • Finally I have found a solution of my problem. Using code like Dmitry Timoshenko has posted, FBSDKGameRequestDialog calls its dealloc, where it nilify his _delegate. That's why I didn't reach any FBSDKGameRequestDialogDelegate methods. I made a strong @property for FBSDKGameRequestDialog and now I receive facebook user ids in gameRequestDialog:didCompleteWithResults:.