3

我正在使用fb_graph rails gem 向我的用户的 Facebook 提要发布消息。

我已请求以下权限:

:scope => 'email, publish_actions, offline_access, publish_stream'

我可以发布到用户的提要。但我无法摧毁它。

当我在 Rails 控制台中执行以下命令时,您会看到错误:

me = FbGraph::User.me( user.access_token )
@facebookpost = me.feed!( :message => "sample feed message", :description => 'sample message')
post = me.feed.find(@facebookpost.identifier).first

post.destroy # this generates the following error

FbGraph::InvalidRequest: OAuthException :: (#100) Invalid parameter
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/exception.rb:47:in `block in handle_httpclient_error'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/exception.rb:44:in `each'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/exception.rb:44:in `handle_httpclient_error'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/node.rb:146:in `handle_response'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/node.rb:63:in `delete'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/node.rb:43:in `destroy'
from (irb):67
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

  1.9.2-p318 :068 > post.destroy(user.access_token)
TypeError: can't convert Symbol into String
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/node.rb:93:in `delete'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/node.rb:93:in `build_endpoint'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/node.rb:61:in `delete'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/fb_graph-2.4.12/lib/fb_graph/node.rb:43:in `destroy'
from (irb):68
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
from /home/invinc/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

我错过了任何权限吗?我能做些什么来解决这个问题?

4

2 回答 2

1

您可以删除帖子

FbGraph::Post.new(fb_post_id).destroy(access_token: "access_token")

虽然不是最好的 API...

于 2012-06-18T09:16:27.410 回答
0

v2.4 要求您将 fb_post_id 与客户端 ID 结合起来。

FbGraph2::Post.new("#{client_id}_#{fb_post_id}", access_token: "access_token").destroy

于 2015-10-07T16:37:45.903 回答