简体   繁体   中英

Parse.com Android: LocalDataStore doesn't work

I have a parse query:

   ParseQuery<ParseObject> query = ParseQuery.getQuery("Message");


        query.whereEqualTo("recipient",currentUser);
        query.orderByDescending("createdAt");
        query.setLimit(10);
        query.include("sender");

  query.findInBackground(new FindCallback<ParseObject>() {

            @Override
            public void done(List<ParseObject> objects, ParseException e) {

                if(e == null) {

                    Log.i("OBJECT LENGTH?", objects.size() + " ");



            }

        });

If I turn on:

    Parse.enableLocalDatastore(this);

in my ParseApplication.class before the Parse.initialize call, the above query works the first time it is called (objects.size() is > 0, as it should be and is in the data browser) but then eg if I restart the app, the same code executed, returns 0.

Why?

So to be clear:

  • Uninstall app
  • Install app
  • Login
  • Start app
  • Query executes successfully
  • Terminate app, eg with force stop
  • Start app
  • Query returns 0

Redo those steps, with just clearing app data and no uninstall, and it works again once.

What's going on?

I had the same problem that you are describing. It was a bug in the SDK version 1.5 which got fixed with the latest version 1.5.1:

Parse Android Changelog

v1.5.1 — May 30, 2014

Fixed various bugs with Local Datastore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM