简体   繁体   English

区分开发iPhone应用程序版本

[英]Distinguishing development iPhone app versions

I like to keep a store-bought version of my iPhone apps on my phone so that I can reproduce any customer issues that come up, but I obviously also want to run the most current development version. 我喜欢在我的手机上保留一个商店购买的iPhone应用程序版本,以便我可以重现出现的任何客户问题,但我显然也希望运行最新的开发版本。 I can install both (one from iTunes, one from xCode) but I'm interested in ways that I'm better able to tell the two apart. 我可以安装两个(一个来自iTunes,一个来自xCode),但我对能够更好地分辨两者的方式感兴趣。 I could just change the name or icon temporarily, but that doesn't seem very failsafe, ie I might forget and ship it with the wrong icon. 可以暂时更改名称或图标,但这似乎不是非常安全,即我可能会忘记并使用错误的图标运送它。

Is there a happy funtime developer way to do this? 有一个快乐的娱乐时间开发者方式来做到这一点?

I was inspired by Eric's idea of adding a user-defined setting to the project but I didn't want to run a script every time I built the project. 我被Eric的想法添加到项目中的用户定义设置的灵感,但我不想每次构建项目时都运行脚本。

We know that the iPhone looks for icon files named "Icon.png" by default. 我们知道iPhone默认会查找名为“Icon.png”的图标文件。 It turns out that the "Icon File" setting in the project plist isn't necessary at all if you've named your icon properly. 事实证明,如果您已正确命名图标,则根本不需要项目plist中的“图标文件”设置。 However, if there is no file named "Icon.png" in the project, xCode looks at the value of the "Icon File" setting. 但是,如果项目中没有名为“Icon.png”的文件,xCode将查看“图标文件”设置的值。

I set a user-defined setting in "Debug" called "Icon_Name" to a non-standard icon name, "DevIcon.png" and "ReleaseIcon.png" for the "Release" config. 我将“Debug”中名为“Icon_Name”的用户定义设置设置为非标准图标名称,“DevIcon.png”和“ReleaseIcon.png”用于“Release”配置。 The "Icon File" setting in the project plist can now be set to ${ICON_NAME} and will take on the value of whatever config file we're using. 项目plist中的“图标文件”设置现在可以设置为$ {ICON_NAME},并将采用我们正在使用的任何配置文件的值。 Now building under two different configurations does use two different icons. 现在在两种不同配置下构建确实使用两个不同的图标。

Edit: For multiple icons (high res, small, ipad, etc) I made a slightly different approach. 编辑:对于多个图标(高分辨率,小,ipad等)我做了一个稍微不同的方法。 The user-defined setting is now "IconPrepend" which is "Dev" for debug and "Release" for release config. 用户定义的设置现在是“IconPrepend”,它是调试的“Dev”和发布配置的“Release”。 I'm now using "Icon Files" (rather than "Icon File") in the info plist which takes an array of strings. 我现在在信息plist中使用“图标文件”(而不是“图标文件”),它采用字符串数组。 Each string is prepended with ${ICONPREPEND} so that debug configurations look for "DevIcon.png" or "DevIcon@2x.png" and release configurations look for "ReleaseIcon.png" or "ReleaseIcon@2x.png". 每个字符串都以$ {ICONPREPEND}为前缀,以便调试配置查找“DevIcon.png”或“DevIcon@2x.png”,发布配置查找“ReleaseIcon.png”或“ReleaseIcon@2x.png”。

Here's an idea - if you set a User-Defined Setting in your Project Build properties for Debug only along the lines of USE_DEV_ICON=YES (or something). 这是一个想法 - 如果您只在USE_DEV_ICON = YES(或其他)的行中为Debug的Project Build属性设置用户定义的设置。 Then, using the "Run Script" option in your Build Target you could copy different icons based on which Active Configuration you called. 然后,使用构建目标中的“运行脚本”选项,您可以根据所调用的活动配置复制不同的图标。

Something along the lines of (pseudo-code): 某些东西(伪代码):

if ($USE_DEV_ICON == YES)
    cp DevIcon.png Icon.png
else
    cp RealIcon.png Icon.png

Then every time you build, depending on the active configuration, it will copy the correct icon. 然后每次构建时,根据活动配置,它将复制正确的图标。

Most probably there is no other way. 最有可能没有别的办法。 Your app store version and development version is completely different to the OS. 您的应用商店版本和开发版本与操作系统完全不同。 If you want to distinguish, you need to change the icon or name. 如果要区分,则需要更改图标或名称。 You can also include some debugging label (eg version number) in your development version, but you may also forget to remove this. 您还可以在开发版本中包含一些调试标签(例如版本号),但您可能也忘记删除它。

Maybe you'd just buy a second iPhone? 也许你只买第二部iPhone? Seriously. 认真。 On your place I'd ask the same question as you do, but I will definitely take such a solution in mind. 在你的地方,我会问你同样的问题,但我一定会考虑这样的解决方案。 If I was an iPhone (or whatever other specific platform) developer, I'd most probably have more than one. 如果我是一个iPhone(或其他任何特定平台)开发人员,我很可能不止一个。

难道你不能在Info.plist文件中创建一个具有不同Bundle名称的新目标,并且只要你想构建在iPhone上运行的应用程序就使用这个目标吗?

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

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