开发者

Distinguishing development iPhone app versions

开发者 https://www.devze.com 2023-01-06 10:49 出处:网络
I like to keep a store-bought version of my iPhone ap开发者_高级运维ps on my phone so that I can reproduce any customer issues that come up, but I obviously also want to run the most current developme

I like to keep a store-bought version of my iPhone ap开发者_高级运维ps 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. 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. I could just change the name or icon temporarily, but that doesn't seem very failsafe, i.e. 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.

We know that the iPhone looks for icon files named "Icon.png" by default. It turns out that the "Icon File" setting in the project plist isn't necessary at all if you've named your icon properly. However, if there is no file named "Icon.png" in the project, xCode looks at the value of the "Icon File" setting.

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. 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. 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. The user-defined setting is now "IconPrepend" which is "Dev" for debug and "Release" for release config. I'm now using "Icon Files" (rather than "Icon File") in the info plist which takes an array of strings. 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".


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). 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 (e.g. version number) in your development version, but you may also forget to remove this.


Maybe you'd just buy a second 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.


Couldn't you make a new target which has a different Bundle name in the Info.plist file, and use this target whenever you want to build the app to run on your iPhone?

0

精彩评论

暂无评论...
验证码 换一张
取 消