簡體   English   中英

在Android中設置parseUser時出現問題

[英]Problems setting up parseUser in android

我確定這是一個愚蠢的問題,但是我嘗試使用ParseUser添加測試用戶。 由於某種原因,它沒有被添加到服務器中。 任何幫助表示贊賞。 抱歉,如果這看起來很明顯,但是我剛剛開始進行android編程。

活動

public class SignupActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_signup);

        final ParseUser currentUser = new ParseUser();


        currentUser.setUsername("Test");
        currentUser.setPassword("xxx");
        currentUser.setEmail("Test@aol.com");
        currentUser.signUpInBackground(new SignUpCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null){
                    Log.i("User added", "successful");
                }
            }
        });

}}

應用類別

public class MainApplication extends Application {

    @Override
    public void onCreate(){
        super.onCreate();

        Parse.enableLocalDatastore(this);

        Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
                .applicationId("{I have actual app ID here}")
                .clientKey("{I have client key here}")
                .server("{It is here}")
                .build()
    );

        ParseObject parseObject = new ParseObject("FloridaLaw");


        ParseACL defaultACL = new ParseACL();
        defaultACL.setPublicReadAccess(true);
        defaultACL.setPublicWriteAccess(true);
        ParseACL.setDefaultACL(defaultACL, true);



    }
}

打印軌跡

11-04 19:56:44.678 22669-22669/? I/zygote: Not late-enabling -Xcheck:jni (already on)
11-04 19:56:44.718 22669-22669/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
11-04 19:56:45.206 22669-22669/com.ronaldpitt.floridalaw I/InstantRun: starting instant run server: is main process
11-04 19:56:45.520 22669-22676/com.ronaldpitt.floridalaw I/zygote: Waiting for a blocking GC ObjectsAllocated
11-04 19:56:45.672 22669-22680/com.ronaldpitt.floridalaw I/zygote: Background concurrent copying GC freed 7395(2MB) AllocSpace objects, 0(0B) LOS objects, 59% free, 1051KB/2MB, paused 3.900ms total 182.247ms
11-04 19:56:45.677 22669-22676/com.ronaldpitt.floridalaw I/zygote: WaitForGcToComplete blocked for 156.076ms for cause ObjectsAllocated
11-04 19:56:46.047 22669-22721/com.ronaldpitt.floridalaw I/OpenGLRenderer: Initialized EGL, version 1.4
11-04 19:56:46.049 22669-22721/com.ronaldpitt.floridalaw W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...

您是否已將Application類MainApplication.java添加到AndroidManifest.xml

<application
  android:name=".MainApplication"
  ...>
  ...
</application>

如果不起作用,請嘗試直接在AndroidManifest.xml而不是Application類中進行操作

<application ...>
  <meta-data
    android:name="com.parse.SERVER_URL"
    android:value="@string/parse_server_url" />
  <meta-data
    android:name="com.parse.APPLICATION_ID"
    android:value="@string/parse_app_id" />
  <meta-data
    android:name="com.parse.CLIENT_KEY"
    android:value="@string/parse_client_key"
  ...
</application>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM