parse-community / ParseLiveQuery-Android

Parse LiveQuery client for Android.
Other
84 stars 32 forks source link

ParseQuery in LiveQuery not support "include" #75

Closed gmalija closed 6 years ago

gmalija commented 7 years ago

Hello,

I have a Table like: ObjectId | createdAt | Job | User

What I need is get data from each pointer in my SubscriptionHandling. But I get always:

    E/ParseLiveQueryClient: Error handling message
    java.lang.IllegalStateException: ParseObject has no data for 'Title'. Call fetchIfNeeded() to get the data.
                                                                         at com.parse.ParseObject.checkGetAccess(ParseObject.java:3599)
                                                                         at com.parse.ParseObject.getString(ParseObject.java:3175)
                                                                         at es.jobin.jobinapp.chat.ChatMainActivity$5.onEvents(ChatMainActivity.java:344)
                                                                         at com.parse.Subscription.didReceive(Subscription.java:80)
                                                                         at com.parse.ParseLiveQueryClientImpl.handleObjectEvent(ParseLiveQueryClientImpl.java:325)
                                                                         at com.parse.ParseLiveQueryClientImpl.parseMessage(ParseLiveQueryClientImpl.java:258)
                                                                         at com.parse.ParseLiveQueryClientImpl.access$000(ParseLiveQueryClientImpl.java:24)
                                                                         at com.parse.ParseLiveQueryClientImpl$1.call(ParseLiveQueryClientImpl.java:203)
                                                                         at com.parse.ParseLiveQueryClientImpl$1.call(ParseLiveQueryClientImpl.java:201)
                                                                         at bolts.Task$4.run(Task.java:357)
                                                                         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                         at java.lang.Thread.run(Thread.java:760)

I read ParseLiveQuery doesn't support "include" in their ParseQuery. Is that right? Or is an error and I can solve it?

CODE:

    ParseQuery<ParseObject> queryChatHandling = ParseQuery.getQuery("Chat");
    queryChatHandling.selectKeys(Arrays.asList("Job.Title"));
    queryChatHandling.include("Job");
    queryChatHandling.whereEqualTo("User", ParseUser.getCurrentUser());

    ParseLiveQueryClient parseLiveQueryChat = ParseLiveQueryClient.Factory.getClient();
    SubscriptionHandling<ParseObject> subscriptionHandling = parseLiveQueryChat.subscribe(queryChatHandling);

    subscriptionHandling.handleEvents(new SubscriptionHandling.HandleEventsCallback<ParseObject>() {
        @Override
        public void onEvents(ParseQuery<ParseObject> query, SubscriptionHandling.Event event, ParseObject chat) {
            Log.d(TAG, "JOB TITLE: " + chat.getParseObject("Job").getString("Title"));
        }
   });

Thanks.

flovilmart commented 7 years ago

LiveQuery doesn’t support includes yet