[英]What's the best way using XCode to install multiple builds of the same iOS app to your 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. 我经常发现我需要在我的iPhone上构建一个可以指向我的演示服务器的“演示就绪”版本。 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.
我最好使用相同的XCode项目来构建和安装到iPhone上。
You can add special build configurations for them that each use a different info.plist file. 您可以为每个使用不同info.plist文件的特殊构建配置添加。 So, maybe for your demo, you have an info.plist named MyApp-Info-DEMO.plist and MyApp-Info.plist for the release.
因此,也许对于您的演示,您有一个名为MyApp-Info-DEMO.plist的info.plist和发布的MyApp-Info.plist。
Then you could add your server variable as an info.plist variable and look it up when the app starts. 然后,您可以将您的服务器变量添加为info.plist变量,并在应用程序启动时查找它。 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.
或者甚至只是在新配置中创建一个DEFINE语句,类似于演示的SERVER = demo.myserver.com和实时的SERVER = production.myserver.com。
The most important part is to change the CFBundleIdentifier in the new info.plist. 最重要的部分是更改新info.plist中的CFBundleIdentifier。 So in your demo, you could name it something like com.mycompany.myapp.DEMO and the real one might just be com.mycompany.myapp.
因此,在您的演示中,您可以将其命名为com.mycompany.myapp.DEMO,真正的可能就是com.mycompany.myapp。
This will allow both versions to appear on the phone at the same time (the different CFBundleIdentifiers). 这将允许两个版本同时出现在手机上(不同的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.
请记住,如果您使用应用内购买或服务器推送通知,如果没有针对您的真实应用标识符和演示应用标识符的单独的特定配置文件,您将无法执行此操作。
You could create 2 different targets with 2 different info.plists and 2 different preprocessor defines (in the Build Settings for each of the 2 targets). 您可以使用2个不同的info.plists和2个不同的预处理器定义创建2个不同的目标(在2个目标中的每个目标的构建设置中)。 Then ifdef on the preprocessor defines to select the server constant the compiler uses for each target.
然后预处理器上的ifdef定义选择编译器为每个目标使用的服务器常量。
Then make the product name and the bundle ID different in the two different target settings (so that neither the device or the Simulator will confuse the two app bundles). 然后在两个不同的目标设置中使产品名称和包ID不同(这样设备或模拟器都不会混淆两个应用程序包)。
With the current version of Xcode, you'd achieve this by changing the app's Info.plist file to use a different bundle identifier (and possibly also change the Product Name of the app in the build settings). 使用当前版本的Xcode,您可以通过更改应用程序的Info.plist文件来使用不同的包标识符(并且还可能在构建设置中更改应用程序的产品名称)来实现此目的。
The upcoming version of Xcode, from what I've read in the prerelease documentation, has a feature that may simplify what you want to do quite a bit. 即将发布的Xcode版本,从我在预发布文档中读到的,有一个功能,可以简化你想要做的很多。 However, since prerelease software is covered under NDA, I can't give you any details.
但是,由于预发布软件受NDA保护,我无法向您提供任何详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.