3
votes

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 ?

2
Did you find the solution?Alizain Prasla
@AlizainPrasla Actually later on, we kept it to basic level, where we just used to open the app rather than going to particular screen.JiteshW
how you app is redirecting from facebook? I am having issue. As facebook is using webview. its not redirecting to my app. Any solution?Alizain Prasla
Not sure but it was something like 1. Adding URL schemes in your info plist. 2. Adding meta tags in your webpage post. 3. Adding some key in Facebook account. I can't recollect as I am not working on it anymore.JiteshW
Thanks anyways. Well in my case. developers.facebook.com/tools/debug/sharing help me to check correct meta tags. as i was testing, few metas required more detail of that meta. If you don't provide it. Facebook not going to redirect on your appAlizain Prasla

2 Answers

2
votes

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

0
votes

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