我的info.plist
FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL URLWithString:@"https://fb.me/450262455167157"];
//optionally set previewImageURL
content.appInvitePreviewImageURL = [NSURL URLWithString:@"https://www.apple.com/my_invite_image.jpg"];
// present the dialog. Assumes self implements protocol `FBSDKAppInviteDialogDelegate`
[FBSDKAppInviteDialog showFromViewController: self
withContent: content
delegate: self
];
//FBSDKAppInviteDialog delegate
-(void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results
{
NSLog(@"%@",results);
}
-(void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error
{
NSLog(@"%@",error);
}
答案 0 :(得分:0)
applink不是你的fb链接,它是你的服务器php脚本链接,
"http://ipaddress/folder/sample.php"
<强> 代码: 强>
FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL URLWithString:@"http://ipaddress/folder/sample.php"];
//optionally set previewImageURL
content.appInvitePreviewImageURL = [NSURL URLWithString:@"http://ipaddress/folder/image.jpg"];
// present the dialog. Assumes self implements protocol `FBSDKAppInviteDialogDelegate`
[FBSDKAppInviteDialog showWithContent:content
delegate:self];
<强> 说明: 强>
<强> 1。 appLinkURL - 我已经告诉过这是您服务器上的脚本。 appInvitePreviewImageURL - 您也可以从同一台服务器调用图像。
appLinkURL包含(在sample.php中) 示例appname = stackoverflow(此处应添加您的appname)
代码:
<html>
<head>
<meta property="al:ios:url" content="stackoverflow://" />
<meta property="al:ios:app_store_id" content="123456789" />
<meta property="al:ios:app_name" content="stackoverflow'" />
<meta property="al:android:url" content="stackoverflow://" />
<meta property="al:android:app_name" content="stackoverflow" />
<meta property="al:android:package" content="com.mycompany.couchin" />
<meta property="al:web:url" content="http://google.com" />
</head>
<body>
Sample App
</body>
</html>
说明: al:ios:url =这称为url架构,你应该将这个url架构添加到下面的info.plist示例中,
al:ios:app_store_id:添加appstore ID,如果你没有appstore id,请在appstore中添加示例应用程序。
al:ios:app_name:在这里给你appname。
<强> 2.appInvitePreviewImageURL 强> 当您邀请朋友时,应该从链接显示此图像。