Facebook 应用邀请 iOS v4 SDK 错误

Facebook App Invites iOS v4 SDK error

我已经仔细检查了所有内容,根据我的理解,这就是我需要做的:

self.inviteContent = [[FBSDKAppInviteContent alloc] initWithAppLinkURL:[NSURL URLWithString:@"http://mywebsite.com"]];
[FBSDKAppInviteDialog showWithContent:self.inviteContent delegate:self];

在 mywebsite.com 我在标题中有这个(此处显示示例值):

<html>
<head>
    <title>My Website</title>
    <meta property="al:ios:url" content="appurl://action">
    <meta property="al:ios:app_store_id" content="1234567">
    <meta property="al:ios:app_name" content="My App">
</head>
<body>
    ...
</body>
</html>

所以对话框切换到最新的 Facebook iOS 应用程序。我写了一条消息并选择了我想向其发送邀请的人,点击发送,我收到了这个错误:

Missing App Link URL
The app link used with this invite does not contain an Android or iOS URL. Developers are required to enter a URL for at least one platform.

我做错了什么?

我的应用程序可以很好地处理自定义 URL,因为如果我在 Mobile Safari 中输入 appurl://action,它会打开我的应用程序。

您需要创建一个 AppLink URL from here/

  1. 从列表中选择您的应用程序

  2. 用等效信息填写表格

  3. 点击下一步!

  4. 大功告成。

现在,您可以将 link 与您的邀请码一起使用。

self.inviteContent = [[FBSDKAppInviteContent alloc] initWithAppLinkURL:[NSURL URLWithString:APP_LINK_HERE]];
[FBSDKAppInviteDialog showWithContent:self.inviteContent delegate:self];

link 的格式类似于 https://fb.me/xxxxxxxxxxxxxxxx

所有 x 将被替换为数字。

尝试添加 og:title 和 og:type 属性,对我有用

<meta property="og:title" content="My App" />
<meta property="og:type" content="website" />

添加元标记可以解决此问题,这是通过 FB 创建的应用 link 中 html 的片段。 Facebook 正在其应用程序 link url 页面上添加一些额外的元标记,如果在浏览器中打开它也会直接重定向到 iTunes。

<html>
<head>
 <title>app name</title>
 <meta property="fb:app_id" content="your fb app id" />
 <meta property="al:ios:url" content="Your app link url" />
 <meta property="al:ios:app_name" content="your app name" />
 <meta property="al:ios:app_store_id" content="your app id" />
 <meta property="al:web:should_fallback" content="false" />
 <meta http-equiv="refresh" content="0;url=https://itunes.apple.com/WebObjects/MZStore.woa/wa/redirectToContent?id=your app store id" />
</head>
<body>
 Redirecting...
</body>
</html>