问题
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