Neeraj Pathak Neeraj Pathak - 6 months ago 101
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

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

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fbapi20130214</string>
        <string>fbapi20130410</string>
        <string>fbapi20130702</string>
        <string>fbapi20131010</string>
        <string>fbapi20131219</string>
        <string>fbapi20140410</string>
        <string>fbapi20140116</string>
        <string>fbapi20150313</string>
        <string>fbapi20150629</string>
        <string>fbapi20160328</string>
        <string>fbauth</string>
        <string>fbauth2</string>
        <string>fb-messenger-api20140430</string>
        <string>fb-messenger-platform-20150128</string>
        <string>fb-messenger-platform-20150218</string>
        <string>fb-messenger-platform-20150305</string>
        <string>fb-messenger-api</string>
        <string>fbshareextension</string>
    </array>

additionally do below two things 1. Open facebook.com -> 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.