I've been looking for an equivalent Swift code sample for Facebook friend invite for iOS apps. But I can't find them.
I understand that there is the Objective-C version on Facebook page https://developers.facebook.com/docs/app-invites/ios. However, because I started off with Swift, I find it difficult to translate.
Could someone point me to a source? Thank you.
the code working :
-In viewDidLoad :
-In your viewController to conform the protocol delegate:
Facebook Friend invite in Swift 3.0
First of all, import FBSDKCoreKit, FBSDKShareKit and add delegate FBSDKAppInviteDialogDelegate. Then, on invite friend button click, add the code below:
Then, add the methods below of FBSDKAppInviteDialogDelegate:
Benobab solution is perfect, i just want to to add that in my case trying to run FBSDKAppInviteDialog.showFromViewController on viewDidAppear worked better.