简体   繁体   English

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

[英]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.

相关问题 将iPhone应用程序(iOS SDK)连接到php / MySql后端的最佳方法是什么 - What's the best way to connect iPhone app (iOS SDK) to php/MySql backend 在iphone应用程序中记录调试信息的最佳方法是什么? - What's the best way to log debug info in an iphone app? 在iOS应用程序中存储静态数据的最佳方法是什么? - What's the best way to store static data in an iOS app? 保持ios应用程序登录的最佳方法是什么? - What's the best way to keep ios app signed in? iPhone应用程序最佳实践-使用IB是设计应用程序的更好方法,还是更好地自行编写UI代码? - iphone app best practice - is using the IB a better way to design your app, or writing UI code on your own better? 在iPhone应用程序中绘制椭圆的最佳方法是什么? - What is the best way to draw this ellipse in an iPhone app? 更新iPhone应用程序数据的最佳方法是什么? - What is the best way to update data for an iPhone app? 在iPhone上存储数据的最佳方法是什么? - What's the best way to store data on iPhone? 保存iPhone应用程序设置的最佳方法是什么? - What is the best way to save iphone app settings? 编写混合iPhone应用程序的最佳方法是什么? - What is the best way to write a hybrid iPhone app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM