delphi - Invalid class typecast exception ,How I can solve it? -
i try use firebase4delphi there no documentation , , got exception invalid class typecast when try use !
i have got error when executing function (it compiles normally).
procedure tfirebasechatfacade.parseresponse(aresp: ifirebaseresponse); var obj: tjsonobject; i: integer; key: string; chatmsg: tchatmessage; jsonresp: tjsonvalue; begin jsonresp := tjsonobject.parsejsonvalue(aresp.contentasstring); if (not assigned(jsonresp)) or (not(jsonresp tjsonobject)) begin if assigned(jsonresp) jsonresp.free; exit; end; obj := jsonresp tjsonobject; try tmonitor.enter(fmessages); try := 0 obj.count - 1 begin key := obj.pairs[i].jsonstring.value; if not fmessages.containskey(key) begin chatmsg := tchatparser.getmessage (obj.pairs[i].jsonvalue tjsonobject); //exception raise here. fmessages.add(key, chatmsg); onnewmessage(chatmsg); removeoldermessage; end; end; tmonitor.exit(fmessages); end; obj.free; end; end;
Comments
Post a Comment