- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我在演示应用程序中实现了 Facebook 应用程序邀请。它工作正常,但没有收到通知。
I have added all detail in my question, now can anyone tell me what is the issue in my code and what should I do to resolve this. I have created test users for testing this app.
此代码运行良好,它启动一个对话框,显示好友列表,还显示应用邀请已发送,但当我在好友帐户中查看时,它没有显示任何通知。
My Info.plist File
我想我在 info.plsit 下的 URL Type (URL 计划)。我已经写了 Action ,这是方法的名称,但我没有 知道我应该在这个专栏中写什么。
Appdelegate.m
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication];
if ([parsedUrl appLinkData])
{
NSURL *targetUrl = [parsedUrl targetURL];
[[[UIAlertView alloc] initWithTitle:@"Received link:"
message:[targetUrl absoluteString]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
}
return YES; }
ViewController.h
Getting result null when
appInviteDialog:(FBSDKAppInviteDialog
called
*)appInviteDialog didCompleteWithResults:(NSDictionary *)results
- (IBAction)action:(UIButton *)sender
{
FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL URLWithString:@"https://fb.me/*****************"];
[FBSDKAppInviteDialog showFromViewController:self withContent:content delegate:self];
}
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results
{
NSLog(@" result %@",results);
}
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error
{
NSLog(@"error = %@", error);
NSString *message = error.userInfo[FBSDKErrorLocalizedDescriptionKey] ?:
@"There was a problem sending the invite, please try again later.";
NSString *title = error.userInfo[FBSDKErrorLocalizedTitleKey] ?: @"Oops!";
[[[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
}
最佳答案
尝试将其放入您的 AppDelegate.m
:
在顶部导入:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
并将其用于应用程序:openurl: sourceapplication: annotation
- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
{
if (!url) {
return NO;
}
[[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
return YES;
}
这使用 Facebook SDK 来处理 openurls 而不是自定义处理程序。
这将触发您定义的委托(delegate)方法,然后您可以继续提醒用户或做任何您想做的事情。
也在你的info.plist
URLSchemes
值需要与您在 Facebook 输入“带有自定义方案的 URL”中的值相同。例如,如果您有 myapp://
在 Facebook 对话框中的“带有自定义方案的 URL”中,然后是您的 URLScheme
将是 myapp
(你目前有 action
)
所做的只是让 Safari 知道如果您调用 myapp://
在 URL 栏中然后它应该打开你的应用程序。除非您将参数传递给应用程序,否则您在 myapp://
之后不需要任何内容。在 Facebook 屏幕上。
确保在您的开发者设置 (https://developers.facebook.com/apps/ {app-id}/settings/) 中添加了 iOS 平台,并设置了捆绑 ID 和 iPhone 商店 ID 以及iPad 商店 ID。
您可以为 iPhone 和 iPad 应用程序 ID 使用任何应用程序 ID(来自 itunes connect,实际上称为“Apple id”)(只需确保它是来自应用程序商店的有效应用程序 ID,名称不必匹配) 并为您的应用使用您的包 ID。 iPhone 和 iPad 的 ID 可以相同。这是至关重要的,因为如果没有这个,Facebook 不会向用户发送通知,因为如果用户没有下载应用程序,它不知道将用户发送到哪里。将其放入并发送另一个通知,它应该可以工作。
使用 Facebook 的“快速入门”创建应用邀请链接时,请确保您在 iOS 框中正确设置了参数。这是设置应该是什么样子的示例。这是看起来像 https://fb.me/634411166661512
的链接
无论您在 info.plist
中有什么,“带有自定义方案的 URL”都必须相同- 如果您有 myapp
,请使用上面的答案在你的info.plist
在 URLSchemes
下您可以将“myapp://”放入 Facebook“带有自定义方案的 URL”中。应用名称可以是任何名称,仅供显示。虽然它说“App Store Id”是可选的,但它是必需的。确保在这里使用与上面设置“iPad Store Id”和“iPhone Store Id”时相同的一个。如果用户没有您的应用程序,这会告诉 Apple 将用户推送到 iTunes 商店。
关于ios - Facebook App 邀请通知在 ios 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33802803/
我尝试在 Django 中向所有订阅者发送新闻通讯邮件,但我无法决定在 Django 中执行此操作的最佳方法是什么。 首先,我列出了 5 个电子邮件地址并按计划发送(例如延迟 5 分钟)但是,因为我将
我有 Firebase 邀请使用电子邮件和短信就好了。然而,当涉及到通过 Facebook 或 twitter 共享时,我一无所知。通过 Firebase 与 Facebook 邀请共享数据的选项有哪
我们目前在一个 React Native 项目上使用 Firestack,这很棒,但是我们还需要通过 Firebase 的“邀请”功能提供的功能。 有人知道 Firebase Invites、iOS
我已受邀加入 GitHub 存储库。我在团队领导的计算机上看到我肯定已被邀请。但是我没有收到电子邮件,登录 GitHub 时也看不到任何通知。如何找到我的邀请并加入存储库? 最佳答案 如果您被邀请加入
我可以邀请用户加入租户。用户确认邀请并被分配订阅中的角色后,他/她可以查看该订阅以及其他租户的订阅。 我可以使用 az account list 列出来自所有不同租户的用户订阅 是否可以对 Azure
我可以邀请用户加入租户。用户确认邀请并被分配订阅中的角色后,他/她可以查看该订阅以及其他租户的订阅。 我可以使用 az account list 列出来自所有不同租户的用户订阅 是否可以对 Azure
我可以问一下在用户邀请他们的 friend 后如何重定向页面吗? 我有这样的代码:(在 javascript 中) function inviteFriends(){ if(isBusy)
我在我的一个 Facebook 应用程序上实现了一个 FB 邀请你的 friend 按钮。 - 邀请效果很好 - 被邀请的用户收到正确的消息,但当他点击它时 - 它只会导致无处可去(空白页面)。 我如
我正在开发一个 Android 应用程序,我必须在其中使用 Rest API 邀请 Facebook 好友参加 Activity 。 下面是我准备参数包的代码 Bundle eventInvit
我正在尝试将邀请 friend 功能集成到我的应用程序中。我成功地实现了 Facebook SDK 和 Facebook 登录,但是当我尝试使用他们文档中的代码时: String appLinkUrl
我正在编写一个娱乐应用程序(一个用 Android 编写的 RESTful 应用程序)。 我想向 Facebook 好友展示并邀请他们加入我的应用。现在我成功加载了FB friend 。接下来我要做什
我正在尝试使用 Facebook API 来启用邀请 friend 使用我的应用程序我使用了 Facebook 开发者文档。问题是,当用户邀请他的 friend 时,notifications 会出现
如何测试动态链接或邀请?是否有可以运行的 adb 命令,以及如何生成该链接。 我试过(有不同的变体) adb shell am start -W -a android.intent.action.VI
我们如何使用我的应用程序邀请我们的 Twitter 好友/关注者参加任何应用程序/事件。为了在 Facebook 上做同样的事情,我将一些消息发布到我的 friend 墙上。有什么方法可以使用 MGT
twitter 是否有类似于 facebook 的应用程序邀请弹出窗口? 在 facebook 你可以这样写: FB.init({ appId : 'xxx', status :
我想知道是否可以使用 FB.ui 邀请 friend 访问我的 Web 应用程序的自定义页面,但不能访问其索引。 Apprequests 方法似乎没有任何可自定义 uri 的参数 FB.ui({m
我一直在网上寻找一种方法来做到这一点,但没有这样的运气。我的目标是将 session 议程模板保存到电子邮件签名中,该签名将插入到我创建的每个 session 邀请中。 正在寻找有关如何执行此操作的一
我目前正在使用以下代码向用户的 Facebook 好友发送邀请。然而,一旦该功能运行,就会弹出一个确认对话框,我必须确认我想将请求发送给我的 friend 。我想跳过这个额外的步骤。有没有办法避免这个
我目前正在使用以下代码向用户的 Facebook 好友发送邀请。然而,一旦该功能运行,就会弹出一个确认对话框,我必须确认我想将请求发送给我的 friend 。我想跳过这个额外的步骤。有没有办法避免这个
我正在编写一个 Facebook iframe/canvas 应用程序,并希望让用户能够邀请 friend 安装此应用程序。目前我正在使用 Facebook 的 PHP-SDK 来登录用户以及与 Fa
我是一名优秀的程序员,十分优秀!