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
You can do something like this:
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 see the list of possible parameters at this page (scroll down): http://developers.facebook.com/docs/reference/dialogs/requests/
To send facebook app invites, you need to first add details of your app here.. https://developers.facebook.com/quickstarts/?platform=app-links-host
In Swift 2.2, XCode 7.3 and FBSDK 4.1
import FBSDKShareKit
import FBSDKCoreKit
import FBSDKLoginKit
Add FBSDKAppInviteDialogDelegate
with your ViewController class.
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
print("Initiation sent")
}
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
print("\(error)")
}
let content = FBSDKAppInviteContent();
content.appLinkURL = NSURL(string: "fb link that you get in above developers facebook url"); //"https:// fb.me/1775107252721102" in my case
FBSDKAppInviteDialog.showFromViewController(self, withContent: content, delegate: self);