Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android TFDQuery导致应用程序无法在iOS模拟器(Delphi 10.3 Upd 3 Firemonkey)上运行_Android_Ios_Delphi_Firemonkey_Firedac - Fatal编程技术网

Android TFDQuery导致应用程序无法在iOS模拟器(Delphi 10.3 Upd 3 Firemonkey)上运行

Android TFDQuery导致应用程序无法在iOS模拟器(Delphi 10.3 Upd 3 Firemonkey)上运行,android,ios,delphi,firemonkey,firedac,Android,Ios,Delphi,Firemonkey,Firedac,我对在iOS平台上运行的TFDQuery有问题,因为它有两个TFDConnections和相同的SQLite驱动程序。应用程序已安装并尝试打开,但立即关闭,没有任何错误消息。当TFDQuery在设计时或运行时设置为active=true时,会出现此错误 我之所以有两个TFD连接,一个是因为我需要RestAPI LocalSQL,另一个是因为我的嵌入式数据库(SQLite3) 此问题我无法在Windows目标平台上解决。我还没有尝试过Android 这是我这个案子的MRE。请注意,我没有在本例中包

我对在iOS平台上运行的TFDQuery有问题,因为它有两个TFDConnections和相同的SQLite驱动程序。应用程序已安装并尝试打开,但立即关闭,没有任何错误消息。当TFDQuery在设计时或运行时设置为active=true时,会出现此错误

我之所以有两个TFD连接,一个是因为我需要RestAPI LocalSQL,另一个是因为我的嵌入式数据库(SQLite3)

此问题我无法在Windows目标平台上解决。我还没有尝试过Android

这是我这个案子的MRE。请注意,我没有在本例中包括RestAPI LocalSQL,因为错误仅限于TFDConnections和TFDQuery

FMX程序:

unit main_u;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf,
  FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async,
  FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef,
  FireDAC.Stan.ExprFuncs, FireDAC.FMXUI.Wait, Data.DB, FireDAC.Comp.Client, System.IOUtils,
  FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt,
  FireDAC.Comp.UI, FireDAC.Comp.DataSet;

type
  TForm9 = class(TForm)
    con2: TFDConnection;
    qry1: TFDQuery;
    cur1: TFDGUIxWaitCursor;
    dvr1: TFDPhysSQLiteDriverLink;
    con1: TFDConnection;
    procedure con2BeforeConnect(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form9: TForm9;

implementation

{$R *.fmx}

procedure TForm9.con2BeforeConnect(Sender: TObject);
begin
  {$IF DEFINED(iOS) or DEFINED(ANDROID)}
    con2.Params.Values['Database'] := TPath.Combine(TPath.GetDocumentsPath, 'smartcart.s3db');
  {$ELSE}
    con2.Params.Values['Database'] := 'D:\My Project Files\5. my_projects_aws-rest\project_x_v0\application\client\database\smartcart.s3db';
  {$ENDIF}
end;

end.
FMX文件:

object Form9: TForm9
  Left = 0
  Top = 0
  Caption = 'Form9'
  ClientHeight = 480
  ClientWidth = 289
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object con2: TFDConnection
    Params.Strings = (
      
        'Database=D:\My Project Files\5. my_projects_aws-rest\project_x_v' +
        '0\application\client\database\smartcart.sdb3'
      'LockingMode=Normal'
      'DriverID=SQLite')
    Connected = True
    LoginPrompt = False
    BeforeConnect = con2BeforeConnect
    Left = 128
    Top = 168
  end
  object qry1: TFDQuery
    Active = True
    Connection = con2
    SQL.Strings = (
      'SELECT * FROM lists')
    Left = 128
    Top = 232
  end
  object cur1: TFDGUIxWaitCursor
    Provider = 'FMX'
    Left = 80
    Top = 32
  end
  object dvr1: TFDPhysSQLiteDriverLink
    Left = 24
    Top = 32
  end
  object con1: TFDConnection
    Params.Strings = (
      'DriverID=SQLite')
    Connected = True
    LoginPrompt = False
    Left = 128
    Top = 112
  end
end
我做了一些研究,没有找到任何与我的案例相关的解决方案。我可以说,TFDQuery在iOS平台上同时运行相同驱动程序的2个TFD连接方面存在一些错误或问题


否则,我可能会错过一些东西。

失败是什么?您在哪一行代码上看到了哪一个错误或异常?@fpiette抱歉,不太清楚。错误是该应用程序安装在iOS上,但在尝试打开时,它会立即关闭,而不会显示任何错误消息。我认为当我在设计时或运行时将TFDQuery设置为Active=True时会出现错误,您应该使用注释中的信息编辑您的问题。您是否尝试在调试器下运行应用程序?我刚刚在模块MultipleFDConnections.exe 0000000000 ab9840中收到错误
异常ESQLiteNativeException。[FireDAC][Phys][SQLite]错误:没有这样的表:列表
,但我检查了表列表,它就在那里。