如何配置我的iPhone项目以使用单独的应用程序图标进行测试版 [英] How can I configure my iPhone project to use a seperate application icon for beta releases

查看:111
本文介绍了如何配置我的iPhone项目以使用单独的应用程序图标进行测试版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现的是,应用程序图标在我发送给我的beta测试人员的版本中与将提交审批的应用程序的版本不同。这将允许我和我的beta测试人员轻松识别该应用程序是测试版。

What I am trying to achieve is for the application icon to be different in builds that I send out to my beta testers, to that of the application that will be submitted for approval. This will allow me and my beta testers to easily identify the app is a beta version.

我不确定是否应该添加构建脚本来修改信息。 plist并更改那里指定的应用程序图标。为此,我想我必须有条件地检查构建类型(DEBUG / RELEASE / DISTRIBUTION等)并将适当的值写入plist文件。

I was not sure if I should be adding a build script to modify the info.plist and change the application icon specified there. For this I guess I would have to conditional check the build type (DEBUG/RELEASE/DISTRIBUTION etc) and write the appropriate value to the plist file.

或者我认为我可能需要为beta版本创建一个单独的目标,并在那里指定新的BETA应用程序图标。

Alternatively I thought I might need to create a separate target for beta releases and specify the new BETA application icon there.

如果有人之前已经完成过这种程序,那么有关如何提示的任何提示和想法非常感谢。

If anyone has done this kind of procedure before, any tips and ideas about how best to do it would be very much appreciated.

推荐答案

过时:截至2017年9月,我的答案现在可能已经过时了。请使用与 资产目录 。资产目录是为您的应用指定图片/图标资源的新方式。

Outdated: As of September 2017, my answer is probably outdated now. Please use latest Apple developer guides relating to Asset Catalogs. Asset Catalogs are the new way of specifying image/icon resources for your app.

原始答案:

您提到的两种方式都可用于此目的(通过单独的Target或使用Build设置)。在我看来,更合乎逻辑的方法是使用不同的构建配置并设置plist文件以从构建配置中动态获取图标文件名。

Both ways you have mentioned can be used for this purpose (Through a separate Target or using Build settings). In my opinion, the more logical way would be to use a different build configuration and set the plist file to dynamically get the icon file name from the build configuration.

这是我将如何做:


  1. 在项目构建设置中,创建一个名为ICON_FILE的新用户定义变量(用于所有配置)

  2. 将变量的值设置为Icon.png(对于所有配置)

  3. 创建一个名为Beta的新构建配置。

  4. 为Beta配置将ICON_FILE变量的值设置为Icon-beta.png。

  1. In project build settings, create a new user-defined variable called ICON_FILE (for "All Configurations")
  2. Set the value of the variable to "Icon.png" (for "All Configurations")
  3. Create a new build Configuration called "Beta".
  4. Set the value of the ICON_FILE variable to "Icon-beta.png" for "Beta" configuration.

(这将使所有配置都具有值Icon.png,除了Beta配置)

(this will make all the configurations have the value "Icon.png" except Beta config)

在Info.plist中设置Icon的值文件属性为 $ {ICON_FILE} 。这将使info.plist从您之前定义的变量中动态获取文件名。

In the Info.plist set the value of "Icon file" attribute to ${ICON_FILE}. This will make the info.plist dynamically get the filename from the variable you defined earlier.

在您的应用程序资源中,包含名称为Icon-beta的beta图标。 png除了你已经拥有的Icon.png。

In your application resources, include the beta icon with the name "Icon-beta.png" in addition to "Icon.png" you already have.

如果您使用Beta配置构建应用程序,该应用程序将使用测试版图标作为应用程序图标。

If you build the app using "Beta" config, the app will have the beta icon as the app icon.

希望这会有所帮助!

这篇关于如何配置我的iPhone项目以使用单独的应用程序图标进行测试版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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