我正在使用fb_graph rails gem向我的用户的Facebook Feed发送消息。
我已请求以下权限:
:scope => 'email, publish_actions, offline_access, publish_stream'
我可以发布到用户的Feed。但我无法摧毁它。
当我在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>'
我是否错过了任何权限?我该怎么做才能解决这个问题?
答案 0 :(得分:1)
您可以使用
删除帖子FbGraph::Post.new(fb_post_id).destroy(access_token: "access_token")
虽然不是最好的API ......
答案 1 :(得分:0)
v2.4要求您将fb_post_id与客户端ID组合在一起。
FbGraph2::Post.new("#{client_id}_#{fb_post_id}", access_token: "access_token").destroy