FBSDKAppInvite成功,但无法在fbaccount中发送通知 [英] FBSDKAppInvite sucessfully but can't send notification in fbaccount
问题描述
我的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);
}
推荐答案
applink不是您的fb链接,而是您的服务器php脚本链接,
The applink is not your fb link which is your server php script link like,
"http://ipaddress/folder/sample.php"
代码:
Code:
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];
说明:
Explanation:
1. appLinkURL -我已经告诉过您这是您服务器上的脚本. appInvitePreviewImageURL-您也可以从同一服务器调用图像.
1. appLinkURL- I already told this is the script from your server. appInvitePreviewImageURL - You can call the image from same server also.
appLinkURL包含(在sample.php中) 示例appname = stackoverflow(在此处应添加您的appname)
The appLinkURL contains (In sample.php) Example appname = stackoverflow (here you should add your 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示例中,
Explanation: al:ios:url = This is known as url schema you should add this url schema to your info.plist example below,
al:ios:app_store_id:添加应用商店ID,如果您没有应用商店ID,请添加它在应用商店中已存在的示例应用.
al:ios:app_store_id: Add appstore id, If you don't have appstore id, please add it example app already have in appstore .
al:ios:app_name:在此处为您提供应用名称.
al:ios:app_name: Give you appname here.
2.appInvitePreviewImageURL 邀请您的朋友时,应该从链接中显示该图像.
2.appInvitePreviewImageURL This image should be display from the link when you are invite your friend.
这篇关于FBSDKAppInvite成功,但无法在fbaccount中发送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!