Skip to content

handleEvents crash Error handling message #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AnChiChang opened this issue May 17, 2017 · 1 comment
Closed

handleEvents crash Error handling message #62

AnChiChang opened this issue May 17, 2017 · 1 comment

Comments

@AnChiChang
Copy link

My class define:

@ParseClassName("Chat")
public class Chat extends ParseObject {

    private Boolean togroupbuy;
    private ParseObject products;
    private ParseUser user;
    private String chatid;
    private String content;

    public Chat() {

    }


    public Boolean getTogroupbuy() {
        return togroupbuy;
    }

    public void setTogroupbuy(Boolean togroupbuy) {
        this.togroupbuy = togroupbuy;
    }

   ..
}

and my subscription program
ParseLiveQueryClient parseLiveQueryClient = ParseLiveQueryClient.Factory.getClient();

    ParseQuery<Chat> parseQuery = new ParseQuery("Chat");

    SubscriptionHandling<Chat> subscriptionHandling = parseLiveQueryClient.subscribe(parseQuery);

    subscriptionHandling.handleEvents(new SubscriptionHandling.HandleEventsCallback<Chat>() {
        @Override
        public void onEvents(ParseQuery<Chat> query, SubscriptionHandling.Event event, Chat object) {
            Log.d("test", "live query is live");
        }
    });

after change the data via Dashboard, then app will get exception like below:
tw.com.readycom.livequery E/ParseLiveQueryClient: Error handling message
java.lang.ClassCastException: com.parse.ParseObject cannot be cast to tw.com.readycom.livequery.Chat
at tw.com.readycom.livequery.MainActivity$2.onEvents(MainActivity.java:69)
at com.parse.Subscription.didReceive(Subscription.java:80)
at com.parse.ParseLiveQueryClientImpl.handleObjectEvent(ParseLiveQueryClientImpl.java:325)
at com.parse.ParseLiveQueryClientImpl.parseMessage(ParseLiveQueryClientImpl.java:255)
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:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)

@AnChiChang
Copy link
Author

after replace Chat to ParseObject, the problem is fine for get event. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant