Facebook Deep Linking没有打开应用程序

时间:2017-06-14 06:02:27

标签: ios objective-c facebook deep-linking

我在Facebook上分享我的帖子。我正在分享图片,内容网址,说明。我正在使用此代码进行分享:

FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = self;
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentTitle = APP_NAME;
content.contentDescription = text;
content.imageURL = [NSURL URLWithString:[[arrAllEvents valueForKey:@"flyer_image"]objectAtIndex:0]];
content.contentURL = url;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeFeedWeb;
[dialog show];

我为https://developers.facebook.com启用了深层链接(新闻Feed链接启动此应用)选项。 我添加了我的Fbid和URLShema像这样

<key>CFBundleURLSchemes</key>
            <array>
                <string>abcevent://</string>
                <string>fb1......</string>
            </array>

并在appdelegate.m中添加与此相同的代码

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url,NSError *error){
        if([[url scheme] isEqualToString:@"abcevent"])
        {
            [self callNewsletter:url];
        }
    }];

    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
    [FBSDKAppEvents activateApp];

}

现在,如果我通过应用程序在fb上分享我的帖子。该帖子点击不是在iPhone中打开我的应用程序深度链接无法正常工作。 任何人都能说出我对此缺少的其他东西吗?

1 个答案:

答案 0 :(得分:0)

fetchDeferredAppLink方法仅适用于广告。它从未与新闻Feed上有机共享的链接一起使用。您可以阅读有关Facebook in this blog post深度链接的更多限制,但有两个核心要知道:

  1. Facebook从未支持非付费内容的延迟深层链接。
  2. Facebook的App Links标准一度支持正常的深层链接(意味着如果已安装该应用程序),但这已经在iOS上被打破了很长时间。
  3. 如果你想要这种功能,你需要一个单独的解决方案,如Branch.io(完全披露:我在分支团队中)。