iosruby-on-railsfacebookfacebook-graph-apifacebook-requests

Invite Users to A Mobile App Over Facebook


I have an iOS app that I am building that uses a rails server on the backend (also building). I am at a point where I would like to be able to invite users to my app, and think the best way to go about this would be via Facebook.

The Facebook SDK allows for you to create a native dialog that directly communicates with their servers from your device, but I would like the server to control that interaction.

So my desired work flow would be this...

  1. User selects other FB friends to invite
  2. Device ships the invited friend list (FB_UIDs) to my server
  3. Server communicates with Facebook and sends out requests via the FB platform
  4. Invitee(s) get notified in Facebook that they've been invited and are provided a deep link to install the app.

I've been looking for a while now on any tutorials / workflow - but can't find anything. Could anyone point me in the right direction?


Solution

  • DownLoad the facebook SDK first.

    http://developers.facebook.com/ios/

    then use the following code:

    Facebook* facebook = 
       [[Facebook alloc] initWithAppId:@"YOUR_FACEBOOK_APP_ID" andDelegate:self];
    
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                           @"My Title", @"title",
                                           @"Come check out my app.",  @"message",
                                           @"FACEBOOK_USER_ID", @"to",
                                           nil]; 
    
    [facebook dialog:@"apprequests" andParams:params andDelegate:self];
    

    you can refer following url as well:

    http://developers.facebook.com/docs/reference/dialogs/requests/

    hope this will help you.