我正在使用facebooker2和mogli gem与facebook open graph进行交互。我的问题是,我如何才能获得我朋友的ID,以便我可以将他/她的东西发布到他/她的墙上?我所能做的就是用下面的代码发布到我的朋友列表中的第一个朋友:
client = current_facebook_client
@user = Mogli::User.find("me", client) unless(client.blank?)
@friends = Mogli::User.find("me/friends", client) unless(client.blank?)
@page = Mogli::Page.find(@friends.first.id)
post = Mogli::Post.new(:message => "Test message at #{Time.now} (sorry, i'll delete it)")
client.post("#{@user.id}/feed", nil, post)我把朋友的名字传给它,然后尝试一些其他的东西。我搜索了google,还搜索了facebook dev论坛。但我只是不知道我怎么能做到这一点。我如何才能获得我想要发布到的朋友的ID?
感谢您的回答!
发布于 2011-03-28 19:13:50
尝试放入@friends,看看数据记录显示了什么。我猜@friends =Mogli::User.find(“我/朋友”,客户端),除非(client.blank?)返回一个哈希数组。并返回每个朋友的密钥
https://stackoverflow.com/questions/3899595
复制相似问题