Deep Linking Facebook iOS - App don't open

若如初见. 提交于 2019-12-11 13:57:00

问题


I have a problem with the integration of the Facebook deep linking (from a article to my app). I followed the documentation (https://developers.facebook.com/docs/applinks) step by step, there is nothing to do, it doesn't work..

So in my website, I add the metadata :

<meta property="fb:app_id" content="...">
<meta property="al:ios:url" content="appname://event?event_id=127">
<meta property="al:ios:app_name" content="app name">

In my app delegate :

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



BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication];
if ([parsedUrl appLinkData]) {
    // this is an applink url, handle it here
    NSURL *targetUrl = [parsedUrl targetURL];
    [[[UIAlertView alloc] initWithTitle:@"Received link:"
                                message:[targetUrl absoluteString]
                               delegate:nil
                      cancelButtonTitle:@"OK"
                      otherButtonTitles:nil] show];
}

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

Did you have any idea why my app wasn't open ? I also configure my Facebook app settings.


回答1:


Change <meta property="al:ios:url" content="appname://event?event_id=127"> to <meta property="al:ios:url" content="myApp://event?event_id=127">

Your app will recognize the scheme set by your url which is the myApp in this case (You can change it your desired string but both should match). So this should be present in your app's plist to recognize the incoming call to open.

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myApp</string>
            <string>fbXXXXXXXXXXXXXXXX</string>
        </array>
    </dict>
</array>


来源:https://stackoverflow.com/questions/35083555/deep-linking-facebook-ios-app-dont-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!