android - Save ParseObject (subclass) to cloud => [success], pin it immediately => [success], get objects from pinned group [0 results]? -
i have simple subclass of parseobject - wallet
. creating 1 new instance , saving cloud via saveeventuall()
, afterwards trying pin localstore (and broadcast signal app can update uis since reads objects localstore perfrormance.
here's how register subclass in application.oncreate():
public void oncreate() { super.oncreate(); parsecrashreporting.enable(this); parseobject.registersubclass(wallet.class); // <---- parse.enablelocaldatastore(this); parse.setloglevel(parse.log_level_verbose); parse.initialize(this, "private stuff", "private stuff"); parseuser.enableautomaticuser(); parseacl defaultacl = new parseacl(); parseacl.setdefaultacl(defaultacl, true); parseinstallation.getcurrentinstallation().saveinbackground(); if (parseuser.getcurrentuser() == null) parseuser.getcurrentuser().signupinbackground(); }
here full subclass itself:
@parseclassname("wallet") public class wallet extends parseobject { public wallet() { } public void putname(string name) { put("name", name); } public string getname() { return getstring("name"); } public static parsequery<wallet> getquery() { return parsequery.getquery(wallet.class); } }
and simple save of object cloud, pin locally , trying retrieve pin testing:
final wallet c = new wallet(); c.putname(name); c.saveeventually(new savecallback() { @override public void done(parseexception e) { if (e != null) e.printstacktrace(); log.d(getclass().getsimplename(), c.getobjectid() + " saved object id"); c.pininbackground("wallet", new savecallback() { @override public void done(parseexception e) { if (e != null) e.printstacktrace(); parsequery<wallet> pq = wallet.getquery(); pq.frompin("wallet"); pq.countinbackground(new countcallback() { @override public void done(int i, parseexception e) { log.d(getclass().getsimplename(), + " items in pin after saving one"); } }); } }); } });
and surprise, here's see in logcat:
06-29 11:29:00.279: d/(3480): j6ljtkezmf saved object id 06-29 11:29:00.303: d/(3480): 0 items in pin after saving 1
what? got item saved cloud , pinned it? how come there 0 items inside pin group?
thoughts?
i believe in parse, parseobject
class names case sensitive. in code, you've got line pq.frompin("wallet");
, have declared class "wallet"
no results being returned. try changing "wallet"
"wallet"
in line.
Comments
Post a Comment