FBSDKAppEvents成功但无法在fb帐户中发送通知
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);
}
应用程序link 不是你的脸书 link 这是你的服务器 php 脚本 link 喜欢,
"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 = Whosebug(在这里你应该添加你的 appname)
代码:
<html>
<head>
<meta property="al:ios:url" content="Whosebug://" />
<meta property="al:ios:app_store_id" content="123456789" />
<meta property="al:ios:app_name" content="Whosebug'" />
<meta property="al:android:url" content="Whosebug://" />
<meta property="al:android:app_name" content="Whosebug" />
<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
当您邀请您的朋友时,link 应该会显示此图片。
我的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);
}
应用程序link 不是你的脸书 link 这是你的服务器 php 脚本 link 喜欢,
"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 = Whosebug(在这里你应该添加你的 appname)
代码:
<html>
<head>
<meta property="al:ios:url" content="Whosebug://" />
<meta property="al:ios:app_store_id" content="123456789" />
<meta property="al:ios:app_name" content="Whosebug'" />
<meta property="al:android:url" content="Whosebug://" />
<meta property="al:android:app_name" content="Whosebug" />
<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 当您邀请您的朋友时,link 应该会显示此图片。