简体   繁体   中英

Deep Linking Facebook iOS - App don't open

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM