简体   繁体   English

在 XCode 项目中使用 ionic 将静态文件添加到 Resource 文件夹

[英]Add static file to Resource folder with ionic in XCode project

I need to add some files to the " Resource " folder of the IONIC generated XCode project .我需要将一些文件添加到IONIC生成的 XCode 项目的“资源”文件夹中。

File is InfoPlist.strings , in order to localizate the permission messages, this one:文件是InfoPlist.strings ,为了本地化权限消息,这个:

在此处输入图片说明

I've added files in the ionic project folder:我在 ionic 项目文件夹中添加了文件:

"Resources/ios/localization/de.lproj/InfoPlist.strings" "Resources/ios/localization/en.lproj/InfoPlist.strings" "Resources/ios/localization/es.lproj/InfoPlist.strings" "Resources/ios/localization/it.lproj/InfoPlist.strings" "Resources/ios/localization/fr.lproj/InfoPlist.strings" "Resources/ios/localization/de.lproj/InfoPlist.strings" "Resources/ios/localization/en.lproj/InfoPlist.strings" "Resources/ios/localization/es.lproj/InfoPlist.strings" "Resources/ios/ localization/it.lproj/InfoPlist.strings" "Resources/ios/localization/fr.lproj/InfoPlist.strings"

在此处输入图片说明

My question is:我的问题是:

  • What is the way to copy these files when " ionic build ios " is executed, directly in the XCode resource folder?执行“ ionic build ios ”时,直接在XCode资源文件夹中复制这些文件的方法是什么?
  • I need to add something particular in the config.xml file?我需要在config.xml文件中添加一些特定的东西吗? If yes, what?如果是,是什么?

Extract of config.xml file: config.xml文件的摘录:

  <platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <allow-navigation href="*" />
    <config-file parent="ITSAppUsesNonExemptEncryption" platform="ios" target="*-Info.plist">
      <false/>
    </config-file>
    <icon src="resources/ios/icon/icon.png" width="57" height="57" />
    [...]
    <splash src="resources/ios/splash/Default~iphone.png" width="320" height="480" />
  </platform>

I've solved it by creating a new "empty" plugin.我通过创建一个新的“空”插件解决了这个问题。

In the plugin.xml file I've simply added:plugin.xml文件中,我简单地添加了:

<platform name="ios">
    [...]
    <resource-file src="PermissionLocalized.bundle/de.lproj" />
    <resource-file src="PermissionLocalized.bundle/en.lproj" />
    <resource-file src="PermissionLocalized.bundle/es.lproj" />
    <resource-file src="PermissionLocalized.bundle/it.lproj" />
    <resource-file src="PermissionLocalized.bundle/fr.lproj" />
</platform>

and this copy these files on the resource folder of XCode project.并将这些文件复制到 XCode 项目的资源文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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