FBSDKAppInvite成功地,但不能在fbaccount发送通知
问题描述:
我info.plist
FBSDKAppInvite成功地,但不能在fbaccount发送通知
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);
}
答
的应用链接是不是你的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) 示例应用程序的名字=计算器(在这里你应该添加您的应用程序名称)
代码:
<html>
<head>
<meta property="al:ios:url" content="*://" />
<meta property="al:ios:app_store_id" content="123456789" />
<meta property="al:ios:app_name" content="*'" />
<meta property="al:android:url" content="*://" />
<meta property="al:android:app_name" content="*" />
<meta property="al:android:package" content="com.mycompany.couchin" />
<meta property="al:web:url" content="http://google.com" />
</head>
<body>
Sample App
</body>
</html>
说明: 人:IOS:URL =这是被称为URL方案应将此网址架构添加到下方的的info.plist例如,
人:IOS:app_store_id:添加AppStore的ID,如果没有AppStore的编号,请添加示例应用程序已经在appstore中。
al:ios:app_name:在这里给你appname。
2.appInvitePreviewImageURL 当您邀请您的朋友时,应从链接中显示此图片。