将同一iOS应用程序的多个版本安装到iPhone的最佳方法是什么

将同一iOS应用程序的多个版本安装到iPhone的最佳方法是什么

本文介绍了使用XCode将同一iOS应用程序的多个版本安装到iPhone的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常发现我需要在我的iPhone上构建一个可以指向我的演示服务器的演示就绪版本。我还想要一个构建,这是我正在开发的最新和最好的调试版本,指向我的开发服务器。有没有人找到一个非常简单的方法让我安装两个应用程序,这些应用程序可能是完全相同的代码但指向不同的服务器?或者也许我会有一个应用程序,它是最新版本背后的几个版本?我最好使用相同的XCode项目来构建和安装到iPhone上。

I frequently find that I need to have a build on my iPhone which is my 'demo-ready' version which might point to my demo server. I also want a build that is the latest and greatest debug build that I'm developing with that points to my development server. Has anyone found a really simple way for me to install two apps that perhaps are the exact same code but point to different servers? Alternately perhaps I would have an app that was a few versions behind the latest version? Preferably I would use the same XCode project to build and install onto the iPhone.

推荐答案

您可以为它们添加特殊的构建配置每个使用不同的info.plist文件。所以,也许对于你的演示,你有一个名为MyApp-Info-DEMO.plist的info.plist和发布的MyApp-Info.plist。

You can add special build configurations for them that each use a different info.plist file. So, maybe for your demo, you have an info.plist named MyApp-Info-DEMO.plist and MyApp-Info.plist for the release.

然后你可以添加您的服务器变量作为info.plist变量,并在应用程序启动时查找它。或者甚至只是在新配置中创建一个DEFINE语句,类似于SERVER = demo.myserver.com用于演示,SERVER = production.myserver.com用于实时。

Then you could add your server variable as an info.plist variable and look it up when the app starts. Or even just create a DEFINE statement in your new configuration that's something like SERVER=demo.myserver.com for the demo and SERVER=production.myserver.com for the live.

最重要的部分是更改新info.plist中的CFBundleIdentifier。所以在您的演示中,您可以将其命名为com.mycompany.myapp.DEMO,真正的可能就是com.mycompany.myapp。

The most important part is to change the CFBundleIdentifier in the new info.plist. So in your demo, you could name it something like com.mycompany.myapp.DEMO and the real one might just be com.mycompany.myapp.

这将允许两者版本同时出现在手机上(不同的CFBundleIdentifiers)。请记住,如果您使用应用内购买或服务器推送通知,如果没有针对您的真实应用标识符和演示应用标识符的单独的特定配置文件,您将无法执行此操作。

This will allow both versions to appear on the phone at the same time (the different CFBundleIdentifiers). Just remember, if you are using in-app purchases or server push notifications, you won't be able to do this without a separate, specific profile for both your real app identifier and your demo one.

这篇关于使用XCode将同一iOS应用程序的多个版本安装到iPhone的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 23:49