Facebook App Invites iOS v4 SDK error

怎甘沉沦 提交于 2019-12-19 09:08:03

问题


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):

<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. 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.


回答1:


You need to create an AppLink URL from here/

  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

All xs will be replace by a digit.




回答2:


Try to add also og:title and og:type properties, it works for me

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



回答3:


Adding meta tags would solve this, this is snippet of html from app link created via FB. 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.

<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>


来源:https://stackoverflow.com/questions/29402465/facebook-app-invites-ios-v4-sdk-error

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