How to invite friends to my application via facebook iOS SDK and Graph API

zeevblu picture zeevblu · May 31, 2012 · Viewed 27.5k times · Source

I'm writing an iPhone application.

I want to give the user the option to invite friends to start using my application via Facebook.

More specifically I want to present a dialog that will let the user to select specific friends to invite.

How can I do this?

Thanks.

Answer

Prabhu Natarajan picture Prabhu Natarajan · Feb 21, 2014

It's simple you can just write the below code for personalised message and also you can easily select the friend's to whom the request should be sent, it's an straight forward and powerful method.

 [FBWebDialogs
 presentRequestsDialogModallyWithSession:nil
 message:NSLocalizedString(@"FBinviteMessage", nil)
 title:nil
 parameters:nil
 handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {}
];

Just add this six line of code to your Button action method, then the rest will be done by the IOS & FaceBook Inbuilt framework :)