JiteshW
JiteshW

Reputation: 2205

Redirect from facebook to ios app - deep link

I am not able to redirect to my iOS app from facebook post. When I click on that post its gets open as webpage (somehow dosent identify tags for iOS & dosen't redirect to app). Not sure whether its a ios app OR html content or some other issue.

Myapppp.plist content:

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>com.myapp.xyzxyz</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>myapp</string>
            </array>
        </dict>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb123XXX123</string>
            </array>
        </dict>
    </array>



AppName: Myapp (As per plist)



<html lang="en">
  <head>
     <meta property="al:ios:url"                content="myapp://blahblah"/>
     <meta property="al:ios:app_store_id"   content="1234567"/>
     <meta property="al:ios:app_name"       content="Myapp blah blah"/>
</head>

When I simply do "myapp://" from safari, it takes me to my app and I also tried manually opening "myapp://blahblah" which also takes me to app. Hence, I assume my app has valid linking.

When I click on that post from facebook app, it navigates an open that as another webpage which contains one toolbar at the bottom and has one button on it & it shows 3 option. one of them is "open in myapp"

If I try opening some other apps from Facebook app (for e.g. Instagaram post), they too work fine.

Does app name has to be excatly same what I have specified in info.plist and the one in meta_property? Or is there any other mistake ?

Upvotes: 3

Views: 3150

Answers (2)

Alex Bauer
Alex Bauer

Reputation: 13613

This is expected behavior

Unfortunately it is not currently possible to directly launch a third-party app from within the iOS Facebook app. This is a known issue that Facebook has essentially written off as wontfix. This is still possible in the Android Facebook app, but it's unfortunate they haven't been more transparent about the change to the iOS version because there is quite a bit of confusion about it.

Instagram is a special case because it is a Facebook-owned app and gets different treatment.

But you can work around it

Services like Branch.io (full disclosure: I am on the team) get around this by implementing a judicious combination of App Links, URI schemes, and iOS Universal Links. Essentially what you need to do is open a page in the webview and then have a button or other user-driven CTA event that launches the app from there. It's an extra step for the user, but currently the best workaround. If you just want to be able to post a link that goes into your app when it is installed and otherwise goes to a webpage (or the App/Play Store), then Branch links are definitely your simplest solution.

Branch link routing logic

Branch link routing logic

Upvotes: 2

Narendra Pandey
Narendra Pandey

Reputation: 377

i think you have not added LSApplicationQueriesSchemes

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>

Add this in your plist.

- (BOOL)application: (UIApplication *)application
            openURL: (NSURL *)url
  sourceApplication: (NSString *)sourceApplication
         annotation: (id)annotation
{

    if ([url.scheme isEqualToString:@"Your Url Sceme"])

    {
        return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                              openURL:url
                                                    sourceApplication:sourceApplication
                                                           annotation:annotation];

    }

}

\ enter image description here hope it will help

Upvotes: 0

Related Questions