我只是按照此处找到的基本 Parse 快速入门指南进行操作:
https://www.parse.com/apps/quickstart#social/mobile/android/native/new
一切编译和运行都很好,但我检查后发现实际上没有用户在 Parse 上注册。我检查了日志,这是我收到的错误:
PARSE.COM﹕ FAILEDjava.lang.IllegalArgumentException: Cannot save a ParseUser until it has been signed up. Call signUp first.-1
这是我正在使用的代码。如您所见,我只是完全复制了教程,并添加了输出到日志。
public class ParseApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize Crash Reporting.
ParseCrashReporting.enable(this);
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(this, "myappid", "mykey");
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
// defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
ParseUser user = new ParseUser();
user.setUsername("my name");
user.setPassword("my pass");
user.setEmail("email@example.com");
// other fields can be set just like with PareObject
user.put("phone", "650-555-0000");
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
Log.e("PARSE.COM", "SUCCESS");
} else {
Log.e("PARSE.COM","FAILED" + e.getMessage() + Integer.toString(e.getCode()));
// Sign up didn't succeed. Look at the ParseException
// to figure out what went wrong
}
}
});
}
}
我不明白为什么错误提示我先调用 signUp,这不正是我在使用 signUpInBackground 做的吗?任何帮助将不胜感激。
最佳答案
它看起来像一个相同的错误。 https://developers.facebook.com/bugs/426365424187686/ 如果删除“Parse.enableLocalDatastore(this);”它会工作正常。 (API 级别无关紧要) 并且..他们向我保证他们会在下一个版本中修复这个错误。 但尽管有更新(1.8.2->1.9.0),它仍然存在。
我很抱歉我的英语不好。
关于android - Parse 新手,无法注册 ParseUser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29315002/