Delphi XE4 with iOS addon - how to embed files

别等时光非礼了梦想. 提交于 2021-01-29 03:03:09

问题


On Android / Eclipse, I can place files in e.g. assets folder. Can I do something similar in Delphi XE4 for iOS?

i.e. create a folder where data and image files can placed and automatically built into app?

I know I can have images, txt etc. in the form file, but is not what I want if I can avoid it.

...

If I include res.zip in Delphi > Project > Deployment my following code returns false in simulator:

FileExists(GetHomePath + PathDelim + 'res.zip')

FileExists(GetHomePath + PathDelim + 'Documents' + PathDelim + 'res.zip')

For reference, RemoteDir in deployment was set to ./


回答1:


You can do something like this (this is from code where I have a TClientDataSet that I use on iOS.

uses System.SysUtils;

procedure TdtmdlNestoria.DataModuleCreate(Sender: TObject);
begin
  cdsSearches.FileName := GetHomePath + PathDelim + 'Documents' + PathDelim + 'Searchs.xml';
end;

If you are loading a file that you are deploying to the device you will also need to make sure that the project source has System.StartUpCopy as the first item in the uses. (Right click on the project and choose View Source) e.g.

program Project6;

uses
  System.StartUpCopy,
  FMX.Forms,
  Unit5 in 'Unit5.pas' {Form5};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm5, Form5);
  Application.Run;
end.


来源:https://stackoverflow.com/questions/17193344/delphi-xe4-with-ios-addon-how-to-embed-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!