【问题标题】:Facebook warning for app: asks for read and write permissions at the same timeFacebook 应用程序警告:同时要求读取和写入权限
【发布时间】:2013-07-05 21:10:13
【问题描述】:

您好,我收到了来自 facebook 开发者的警告:

您的应用同时要求读取和写入权限。只有当用户尝试向 Facebook 分享内容时,您才应该请求写入权限。

我应该怎么做才能解决这个问题?

谢谢。

【问题讨论】:

    标签: facebook


    【解决方案1】:

    您需要包含Extended Permissions 才能使用“publish_actions”。

    This guide 解释了如何设置权限并将帖子发布到墙上。基本上,前面所述的所需权限是这样包含的:

    private static final List<String> PERMISSIONS = Arrays.asList("publish_actions");
    

    为了发布故事,他们甚至为您提供了必要的代码,这些代码也利用了“publish_actions”权限:

    private void publishStory() {
    Session session = Session.getActiveSession();
    
    if (session != null){
    
        // Check for publish permissions    
        List<String> permissions = session.getPermissions();
        if (!isSubsetOf(PERMISSIONS, permissions)) {
            pendingPublishReauthorization = true;
            Session.NewPermissionsRequest newPermissionsRequest = new Session
                    .NewPermissionsRequest(this, PERMISSIONS);
        session.requestNewPublishPermissions(newPermissionsRequest);
            return;
        } ... }
    

    他们还使用以下代码检查权限:

    private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
    for (String string : subset) {
        if (!superset.contains(string)) {
            return false;
        }
    }
    return true;
    

    }

    这意味着,您只需要使用写入权限,而不是读取权限。

    希望这会有所帮助。

    【讨论】:

    • 谢谢大卫。看来我的应用程序运行正确。获取用户信息是>>阅读...在用户墙上分享>>写作。 facebook警告是“注意”而不是“立即修复”,所以我想这只是一个建议。还是你认为更重要?再次感谢。
    • 不,如果您只是使用扩展权限和此处的“publish_actions”,我会忽略警告,因为那时您似乎正确使用了权限。希望它有所帮助
    【解决方案2】:
    In the rare case your app requires publishing permissions up front (for example, an app that does nothing but publish a user's mood to Facebook).
    (1)first request the bare minimum read permissions at initial login. After the user logs in with Facebook, 
    (2)show the user a screen explaining why your app needs publishing permissions and let the user opt-in to the publishing permission request by clicking a button. 
     This will provide the user more context and improve your conversion.
    
    Another legitimate case for requesting read and publish permissions back-to-back is for users that log in to your app with email or a non-Facebook login option. 
    When these users want to publish to Facebook, your app will need to request read permissions to connect their account followed by publishing permissions back-to-back. 
    In this case, make sure that the only read permissions you request are public profile and friend list. 
    This provides the best user experience because the user wants to simply publish from your app and is not interested in providing additional read permissions. 
    It will also improve your conversion.
    

    【讨论】:

      猜你喜欢
      • 2013-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-29
      相关资源
      最近更新 更多