简体   繁体   English

Facebook应用邀请iOS v4 SDK错误

[英]Facebook App Invites iOS v4 SDK error

I've double checked everything, from my understanding this is all I need to do: 我已经仔细检查了所有内容,据我了解,这就是我需要做的一切:

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

On mywebsite.com I have this in the heading (example values shown here): 在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>

So the dialog switches over the to the latest Facebook iOS app. 因此,对话框将切换到最新的Facebook iOS应用。 I write a message and pick the person I want to send the invite to, hit send and I get this error: 我写了一条消息,然后选择要向其发送邀请的人,点击“发送”,我收到此错误消息:

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.

What am I doing wrong? 我究竟做错了什么?

My app handles the custom URL fine because if I enter appurl://action in Mobile Safari it opens my app up. 我的应用程序可以很好地处理自定义网址,因为如果我在Mobile Safari中输入appurl://action ,它将打开我的应用程序。

You need to create an AppLink URL from here / 您需要从此处 /创建一个AppLink URL

  1. Choose your application from the list 从列表中选择您的应用程序

  2. Fill up the form with equivalent information 用等效信息填写表格

  3. Click on Next ! 点击下一步!

  4. You're done. 你完成了。

Now, you can use that link with your code for invite. 现在,您可以将该链接与您的邀请代码一起使用。

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

The format of that link will be something like https://fb.me/xxxxxxxxxxxxxxxx 该链接的格式将类似于https://fb.me/xxxxxxxxxxxxxxxx

All x s will be replace by a digit. 所有x s都将替换为一个数字。

Try to add also og:title and og:type properties, it works for me 尝试同时添加og:title和og:type属性,它对我有用

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

Adding meta tags would solve this, this is snippet of html from app link created via FB. 添加元标记将解决此问题,这是通过FB创建的应用链接中的html片段。 Fb is adding some extra meta tags on it's app link url page, and it also redirects direct to itunes if opened on a browser. Fb在其应用程序链接URL页面上添加了一些额外的meta标签,并且如果在浏览器中打开,它还会直接重定向到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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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