无法保存未认证的ParseUser [英] Cannot save a ParseUser that is not authenticated

查看:158
本文介绍了无法保存未认证的ParseUser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图抓住用户的谁已经加入了一个组的ParseRelation。我没有问题,直到我说的登录与Facebook。现在,我得到的错误无法保存未认证的ParseUser试图将用户添加到关系然后保存的parseObject时。我可以加入由人创造的群体谁没有与Facebook登录,我可以加入我创建的(我在登录时FB)组,但得到与谁与Facebook登录的其他用户创建群的错误。

\r
\r

mJoinButton.setOnClickListener(新View.OnClickListener(){@\r
  覆盖\r
  公共无效的onClick(视图v){\r
    的parseObject组= mGroups.get(getAdapterPosition());\r
    mJoinedRelation = group.getRelation(ParseConstants.KEY_JOINED_RELATION);\r
    mJoinedRelation.add(mCurrentUser);\r
    group.saveInBackground(新SaveCallback(){\r
\r
      @\r
      覆盖\r
      公共无效完成(ParseException的E){\r
        如果(E == NULL){\r
          Toast.makeText(mContext,你已经加入了团!,Toast.LENGTH_LONG).show();\r
\r
        }其他{\r
          AlertDialog.Builder建设者=新AlertDialog.Builder(mContext)\r
            .setMessage(e.getMessage())\r
            .setTitle(R.string.login_error_title)\r
            .setPositiveButton(android.R.string.ok,NULL);\r
          AlertDialog对话框= builder.create();\r
          dialog.show();\r
        }\r
      }\r
    });\r
  }\r
});

\r

\r
\r


解决方案

如果您对parse.com User类检查ACL栏,你会看到它有公共读取,但它并没有为公共写因此,如果您还没有登录以该用户无法更新行的信息。我相信你将不得不公开写入添加到用户的访问控制列表,如果你希望能够更新,而没有登录ID,虽然我不会推荐它。另一种解决方案是创建一个的parseObject存储非登录信息,这样你就可以在任何地方,因为ACL将被设置为默认的公共写更新。

I'm trying to grab a ParseRelation of user's who have joined a group. I had no problem until I added login with Facebook. Now, I get the error of "Cannot save a ParseUser that is not authenticated" when trying to add a user to the relation and then saving the ParseObject. I can join groups created by people who did not log in with Facebook and I can join groups that I created (I'm logged in with FB), but get the error with group's created by another user who logged in with Facebook.

mJoinButton.setOnClickListener(new View.OnClickListener() {@
  Override
  public void onClick(View v) {
    ParseObject group = mGroups.get(getAdapterPosition());
    mJoinedRelation = group.getRelation(ParseConstants.KEY_JOINED_RELATION);
    mJoinedRelation.add(mCurrentUser);
    group.saveInBackground(new SaveCallback() {

      @
      Override
      public void done(ParseException e) {
        if (e == null) {
          Toast.makeText(mContext, "You have joined the group!", Toast.LENGTH_LONG).show();

        } else {
          AlertDialog.Builder builder = new AlertDialog.Builder(mContext)
            .setMessage(e.getMessage())
            .setTitle(R.string.login_error_title)
            .setPositiveButton(android.R.string.ok, null);
          AlertDialog dialog = builder.create();
          dialog.show();
        }
      }
    });
  }
});

解决方案

If you check the ACL column on your User class on parse.com, you will see that it has Public Read but what it doesn't have is Public Write so you cannot update row information if you are not logged in as that user. I believe you will have to add Public Write to the ACL of that user if you want to be able to update while not logged id, although I wouldn't recommend it. Another solution is to create a ParseObject to store non-login information, that way you will be able to update it from anywhere since the ACL will be set up to Public Write by default.

这篇关于无法保存未认证的ParseUser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆