Neeraj Pathak Neeraj Pathak - 2 years ago 176
iOS Question

App Invites facebook | not getting notification on iOS but getting in android however invitation is listed in facebook -> apps -> app invites

I had added facebook app invite feature in my app below is my code sending app invitations

let content = FBSDKAppInviteContent()
content.appLinkURL = NSURL(string: "applinkurl")
content.appInvitePreviewImageURL = NSURL(string: "appInvitePreviewImageURL")
FBSDKAppInviteDialog.showWithContent(content, delegate: self);

I had added below extension to the class

extension FACEBOOKTEXT:FBSDKAppInviteDialogDelegate {
//MARK: FBSDKAppInviteDialogDelegate
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
print("invitation made")
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
print("error made")

in app delegate :

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
var shouldReturn:Bool = FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation);

shouldReturn = shouldReturn || GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation);
shouldReturn = shouldReturn || Instagram.sharedManager().handleOpenURL(url);
shouldReturn = shouldReturn || LinkedInBridge.handleURL(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation);

return shouldReturn;

I had configured the "App Links" from facebook portal nd put it in infi.plist and content.appLinkURL.

On running this code the app invitations are sent. And when the receiver of the app invitation is on android the invitation is listed in the notification feel of the facebook and use is able to install app via it. But if the receiver of the invitation is on iOS the invitation is not listed in the notification feed of the use however if the user goes to facebook -> More(tab) -> apps -> App invites, here the invitation is listed.

Please guide me where I am doing wrong. and what should I do to list invitations in notification in iOS same like android.
I am using Xcode 6.4 and Swift 1.2
this is working for iOS 8 but not working for iOS 9

Thanks in advance,

Answer Source

add below URL schemes to your info.plist for make it work in iOS 9


additionally do below two things 1. Open -> Settings -> apps -> delete your app if already given permissions to the app

  1. Open mobile facebook app -> tap on More(last tab) -> apps -> app invites -> delete if any app invite is already there.

Hope this will work for you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download