如何更正此运行时错误,为什么在Delphi中得到它?

问题描述

我正在尝试在Delphi中调用远程API函数

componentDidMount(){
//Request to api and update the state! if there were no data set it to null
}
render(){return ({this.state.yourValue ? <TheComponentToRunIfThereIsData /> : < TheComponentWhenThereIsNoData /> })}

但是在运行时,出现此错误

模块generate_xml_exe中地址00791D72的访问冲突。写入地址0000000C。

这是什么,我该如何纠正?在运行时单击按钮时,我收到此错误

procedure TForm4.Button1Click(Sender: TObject); var getBalance1 : getBalance; type1 : consenttype; begin getBalance1.consent.type_ := type1; getBalance1.consent.target := Edit5.Text; getBalance1.consent.id := Edit6.Text; Application.ProcessMessages; valasz := (HTTPRio1 as AccountInfo_PT).getBalance(getBalance1); end; getBalance的一类:

getBalance_Type

这些行会导致运行时错误

  getBalance_Type = class(TRemotable)
  private
    Fconsent: consent5;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property consent: consent5  Index (IS_UNQL) read Fconsent write Fconsent;
  end;
    
  // ************************************************************************ //
  // XML       : getBalance,global,<element>
  // Namespace : http://bbrt.hu/openApiServices/AccountInfo/1/
  // Info      : Wrapper
  // ************************************************************************ //
  getBalance = class(getBalance_Type)
  private
  published
  end;

  consent5 = class(TRemotable)
  private
    Ftype_: consentType;
    Ftarget: targettype;
    Fid: consentIdType;
  published
    property type_:  consentType    Index (IS_UNQL) read Ftype_ write Ftype_;
    property target: targettype     Index (IS_UNQL) read Ftarget write Ftarget;
    property id:     consentIdType  Index (IS_UNQL) read Fid write Fid;
  end;

但是我不知道该如何纠正。

解决方法

直接导致访问冲突的原因是未创建类型为 getBalance getBalance1

通常需要通过一个名为Create的构造函数来创建Delphi中的所有CLASS。由于您没有隐式创建 getBalance1 变量,它包含一个随机值,因此您不能(安全地)访问其内容。

因此,在开始使用 getBalance1 变量之前,需要创建它,如下所示:

MST of G