简体   繁体   中英

Delphi XE4 with iOS addon - how to embed files

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

ie 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 ./

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) eg

program Project6;

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

{$R *.res}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM