简体   繁体   English

难以获得用户喜欢的所有页面

[英]Difficulty getting all pages a user likes

I use this code, it get all pages the user likes: 我使用这段代码,它可以获得用户喜欢的所有页面:

@user = session[:graph].get_object('me')
    like = session[:graph].get_connections("me", "likes")
    if !(like.to_s.include?('appid'))
     redirect '/youneedlike'
    end

It's works for me and my mates, but some users have error: they are always redirected, even though they like our page. 它适用于我和我的伙伴,但有些用户有错误:它们总是被重定向,即使它们喜欢我们的页面。

What's wrong? 怎么了?

Does your app request the user_likes permission ? 您的应用是否请求user_likes 权限

Alternatively, if your app is a canvas app, you can use the signed_request parameter to do the same thing: 或者,如果您的应用是画布应用,则可以使用signed_request参数执行相同的操作:

# pseudocode
signed_request = decode signed_request()
if signed_request['page']['liked']:
  # user liked page, do something cool
else:
  # user doesn't like page. redirect somewhere to tell them why they should

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM