带有iOS插件的Delphi XE4-如何嵌入文件 [英] Delphi XE4 with iOS addon - how to embed files

查看:74
本文介绍了带有iOS插件的Delphi XE4-如何嵌入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android/Eclipse上,我可以将文件放置在资产文件夹.我可以在适用于iOS的Delphi XE4中做类似的事情吗?

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?

我知道我可以在表单文件中包含图像,txt等,但是如果可以避免的话,这不是我想要的.

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

...

如果在 Delphi>项目>部署中包含 res.zip ,则我的以下代码在模拟器中返回false:

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

作为参考,部署中的 RemoteDir 设置为./

For reference, RemoteDir in deployment was set to ./

推荐答案

您可以执行以下操作(这是我在iOS上使用的TClientDataSet中的代码.

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;

如果要加载要部署到设备的文件,则还需要确保项目源将System.StartUpCopy作为使用的第一项.(右键单击该项目,然后选择查看源代码")例如

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.

这篇关于带有iOS插件的Delphi XE4-如何嵌入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆