Parse.com Android - ObjectId为null /空白

时间:2016-01-09 04:32:15

标签: android parse-platform

我正在查询parse.com但由于某种原因我无法获得objectId但是我可以获得其他值。知道为什么我无法检索objectId吗?

我已尝试getObjectId()以及get("objectId")无济于事。

这是一些代码

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

    ParseQuery<ParseObject> query = ParseQuery.getQuery("Schedule");
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> objects, ParseException e) {

            if (e == null) {
                for (ParseObject object : objects) {

                    Log.d("App", "object id: " + object.getObjectId());
                    Log.d("App", "object updated at: " + object.getUpdatedAt());
                    Log.d("App", "object created at: " + object.getCreatedAt());
                }
            }
        }
    });
}

输出:

D/App: object updated at: Sun Oct 11 22:12:38 EDT 2015
D/App: object created at: Sat Oct 10 17:02:43 EDT 2015
D/App: object id: 
D/App: object updated at: Sat Dec 19 10:34:38 EST 2015
D/App: object created at: Sat Oct 10 17:11:18 EDT 2015
D/App: object id: 
D/App: object updated at: Sun Dec 20 17:37:59 EST 2015
D/App: object created at: Sun Dec 20 17:33:44 EST 2015
D/App: object id: 
D/App: object updated at: Thu Jan 07 19:31:05 EST 2016
D/App: object created at: Thu Jan 07 19:30:37 EST 2016

1 个答案:

答案 0 :(得分:0)

发现问题。

我的Schedule类中有一个objectId,因为ParseObject已经有了一个objectId,所以它一直引用这个空白

@ParseClassName("Schedule")
public class Schedule extends ParseObject {
     String objectId = "";
     ...
}

需要删除objectId!