- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发我的 Cordova 应用程序以使其更具病毒性。因此,当他们在游戏中存档新内容时,我想包括 Facebook 和 Open Graph API 以在玩游戏的用户的新闻流中发布。我对整个 Facebook 和开放图谱完全陌生,所以请帮助我开始使用它。
我通过运行以下代码登录一个新用户:
$(login).on("click", function() {
FB.login(function() {
console.log("Default Login succeded");
console.log("Asking for write permissions");
FB.login(function(rsp) {
console.log("GOT WRITE PERMISSIONS");
log(rsp);
}, {
scope : 'publish_stream'
});
}, {scope:"email"});
});
我在命名空间 einszwo
下注册了一个名为 buy
的开放图操作。作为对象,我使用默认的 object
。
尚未审核,但我正在使用开发者 Facebook 帐户登录我的设备。
现在我想调用这个 Action 。为此,我使用以下代码:
var obj = {
title : "I visited Google",
url : "http://www.google.com"
};
function callback(response) {
console.log(JSON.stringify(response));
}
FB.api('me/einszwo:buy','POST',obj, callback);
不幸的是,调用失败,来自 Facebook 的响应如下:
{"error":{"type":"Exception",
"message":"The action you're trying to publish is invalid because it does not
specify any reference objects. At least one of the following properties
must be specified: object.","code":1611072}}
如果有人可以帮助我解决这个问题或提供我的一些信息以便我查找更多信息,那就太好了。
谢谢!
塞巴斯蒂安
编辑
将 url 粘贴为对象的解决方案有效,但我们想使用您在 Facebook Object Browser 中定义的 Facebook 托管对象。该方法是能够发布用户的事件,如果有人点击该事件,我们希望他们被重定向到我们的应用程序信息页面。
我们无法为每个不同的对象提供一个页面。是否可以使用 Facebook Javascript SDK 来使用托管在 facebook 上的预定义对象?
我真的很想有这样的可能性来创建新对象
var o = {
"og:title" : "Test " + new Date(),
"og:url" : "http://facebook.com/appcenter/**APPNAMESPACE**",
"og:type" : "Object"
}
FB.api('/me/**APPNAMESPACE**:buy', 'POST', {
object : o
}, function(response) { console.log(JSON.stringify(response));});
返回
{"message":"(#3503)\"{\"og:title\":\"2013 年 5 月 23 日星期四 12:19:45 GMT+0300 (EEST)\",\"og:url\":\"http://facebook.com/appcenter/einszwo\",\"og:type\":\"Object\"}\"是属性\"object\"的无效值输入\"Reference\"","type":"OAuthException","code":3503}
或一种使用预定义 facebook 对象 ID 的方法,例如:
FB.api('1234567890', 'POST', {
}, function(response) { console.log(JSON.stringify(response));});
谁能帮帮我?
谢谢!
最佳答案
听起来您在谈论应用拥有的对象。
An app-owned object. These objects are used across your entire app. They are public, just like self-hosted objects. Anyone who uses your app can see them and they can be attached to any story your app creates.
您不能将您的 appcenter url 用作对象(如果您考虑开放图 URL 的用途,这真的没有意义,并且几乎是对开放图的滥用)
您在 cURL 中或使用对象浏览器创建对象
在我的例子中,我为我的咖啡店类型创建了一个 Leopluradon 对象。然后我从创建的结果中获得了 id (149831668534005) 并在我的调用中使用了它
FB.api(
'/me/philippeharewood:code',
'post',
{ coffeeshop: '149831668534005' },
function(response) {
if (!response || response.error) {
alert('Error occured');
console.log(response.error);
} else {
alert('Publish was successful! Action ID: ' + response.id);
}
});
可在 http://philippeharewood.com/facebook/charlie.html 找到演示,它对你不起作用,但你明白了要点。
然后您可以在您的事件中看到它。
这一切都在 https://developers.facebook.com/docs/opengraph/using-object-api/ 中进行了解释
关于Facebook Javascript SDK : Publish actions with custom Open Graph objects,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16566557/
我正在细读 http://www.khronos.org/网站,只找到了 OpenCL 的头文件(不是我不关心的 OpenGL)。如何获取 OpenCL SDK? 最佳答案 AMD 的 ATI Str
Android 项目中最低(最低 sdk)和最高(目标 sdk)级别是否有任何影响。这些东西是否会影响项目的可靠性和效率。 最佳答案 没有影响,如果您以 SDK 级别 8 为目标,那么您的应用将以 9
“min sdk version/target sdk version”和“compile sdk version”有什么区别?我知道 min 和 target sdk 是什么意思,但是 compil
我正在尝试运行 Dji Mobile-Sdk-Android:https://github.com/dji-sdk/Mobile-SDK-Android使用 dji 网站上的说明:https://de
我目前正在向我的 iPhone 应用程序添加新的 Facebook iOS sdk 3.1.1。我看到 sdk 有重大变化。例如。我的旧 sdk 创建一个 Facebook 对象并从 FBReques
我最近刚刚下载了 Xcode 4.6 with mac 10.8.4 with iOS 6.0 SDK package,我立即注意到我无法使用我的 iPhone 3Gs with iOS 4.6 进行
我尝试下载 OpenCL SDK。但是没办法。我有一个 AMD GPU,所以我在谷歌上搜索了 AMD SDK,但是来自谷歌的所有链接和一些教程都被破坏了,不可能通过 AMD 开发者网站找到 sdk。
安装 Google Cloud SDK 后,当我运行时 gcloud 授权登录 我收到一条错误消息: Your browser has been opened to visit: https://a
我一直在 nvidia 网站上搜索 GPU 计算 SDK,因为我正在尝试构建具有 cuda 支持的点云库 (PCL)。但是,在 nvidia 网站上,我只能找到工具包的链接,而不是 SDK 的单个下载
Closed. This question needs to be more focused。它当前不接受答案。 想改善这个问题吗?更新问题,使其仅关注editing this post一个问题。 2
当我打开 Android SDK 管理器时,会出现一个屏幕“选择要安装的包”。它列出了一堆带有绿色复选标记(已经安装)的软件包,还有一些带有 x's 的软件包,它们没有安装。如果我选择“全部接受”,它
在开发过程中,我发布了 SDK 21 Lollipop,但我无法在我的 KitKat 设备上使用它。应用程序非常简单,我只将 SDK 用于动画和 Material 设计,但是当我尝试对 Play 商店
enter image description here friend 们好 在使用 Linux、jenkins 和 docker 探索 dotnet 核心时,我遇到了构建问题,该问题在标题“/usr
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我创建了一个flutter项目,运行flutter packages get,输出如下:【二】flutter包搞定等待另一个 flutter 命令释放启动锁...第二次运行“flutter packa
这个问题在这里已经有了答案: What are the Android SDK build-tools, platform-tools and tools? And which version sh
我使用 Corona SDK 已经快一年了,并且开发了几个简单的游戏。我现在正在寻找的是在 Corona SDK 中创建 3D 幻觉的某种方法。如果有人有 Corona 3D 方面的经验,我将不胜感激
我有一个CLDC 1.1 / MIDP 2.0项目,可以使用Java ME SDK 3.2很好地进行编译。 最近,我已将Java SE升级到8,结果Java ME SDK开始在Windows启动时显示
有没有办法以编程方式控制连接到华擎主板的 RGB 照明?我知道华硕有一个 Aura SDK,但华擎是否也有一个用于他们的硬件? 如果是,我在哪里可以找到它? 最佳答案 没有用于华擎多彩的 sdk。但是
如何使用 crm 2011 sdk 和 XrmServiceContext 创建事务? 在下一个示例中,'new_brand' 是一些自定义实体。我想创建三个品牌。第三个拥有错误的 OwnerID g
我是一名优秀的程序员,十分优秀!