Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I query and update _User in leancloud using the API? #20

Open
zoezhou1999 opened this issue Apr 11, 2020 · 2 comments
Open

Can I query and update _User in leancloud using the API? #20

zoezhou1999 opened this issue Apr 11, 2020 · 2 comments

Comments

@zoezhou1999
Copy link

Is your feature request related to a problem? Please describe.
Can I query and update _User in leancloud using the API?

Describe the solution you'd like
I see I can use the api to login in and sign up but when I want to query the infromation from _User datasets and update some other attributes in it, I cannot use general query code to get them...
Thank you for your help!!
@LunaGao

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@zoezhou1999
Copy link
Author

Emmm, I found that login and signup function can be used to query the _User, but I would encounter the error:
classname is null
😢

@zoezhou1999
Copy link
Author

zoezhou1999 commented Apr 11, 2020

AVUser avUser = new AVUser();
  avUser.setUsername(user.userlog.get("username"));
  avUser.setPassword(user.userlog.get("password"));
//  avUser.put("className", "_User");
  try{
//    avUser.find()
    await avUser.login().then((object) {
      avUser = object;
      avUser.put('sex', user.userlog.get('sex'));
      avUser.put('nickname', user.userlog.get('nickname'));
      avUser.save().then((object) {
//        user.userlog.setInt('Id',  object.get("Id"));
        print(object);
        // Updated
      });
    });

  }on Exception catch(e) {
    print('error caught: $e');
  }

Error happens in this code... Strange ENOUGH, because when I update using number attribute it is OK...but failed in String

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant