如何为生产和开发环境 iOS 设置不同的证书和配置文件? [英] How setup different certificates and provisioning profile for production and development environment iOS?

查看:64
本文介绍了如何为生产和开发环境 iOS 设置不同的证书和配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题,但对于开发人员构建应用程序来说非常重要.

This might be a stupid question but very important one for developers to build applications.

我想问的是我们可以为xcode项目的开发和生产环境有条件地设置代码签名身份和配置文件吗?

因此,当我们为生产环境构建应用程序时,我们可以轻松地更改条件并立即为生产环境构建应用程序.否则我们还需要做很多事情,比如更改代码签名标识和配置文件以及包名称.

So when we build application for production environment we can easily change the condition and build application for production immediately. Otherwise we need to do many stuffs like change Code Signing Identity and Provisioning Profile and package name too.

那么是否可以应用这种条件,如果是,那么如何应用?

So is it possible to apply this kind of condition, if yes then how?

我很想知道这是怎么发生的.

I am very curious to know how this happens.

提前致谢.

推荐答案

如果我理解正确,您也可以从 Xcode GUI 执行:

If I understand you correctly, you can also do it from the Xcode GUI:

  1. 使用 Apple 开发者网站创建开发和生产配置文件.

  1. Create development and production provision profile using the Apple Developer Site.

在您的目标设置中,转到 Build Settings 并在搜索字段中输入 Code Sign.

In your target setting, go to Build Settings and write in the search field Code Sign.

  1. 打开配置文件左侧的小箭头.您可以看到,您可以针对开发配置文件进行调试,并针对发布配置您的生产(或 AdHoc)配置文件.

  1. Open the small arrow on the left of the provisioning profile. You can see that you can configure for debug your development profile and for the release, your production (or AdHoc) profile.

转到左上角的方案菜单并选择Manage Scheme.

Go to you scheme menu on the top left corner and choose Manage Scheme.

  1. 您可能只配置了一个方案,因此选择它(按一次)并按左下角的设置按钮.选择复制.

  1. 给这个方案一个名字(我建议像 MyProjectRelease 这样的名字)并选择 Release 配置.

现在,在构建项目之前,您要做的就是更改所需的方案.

Now all you have to do before building your project, is change to the wanted scheme.

这篇关于如何为生产和开发环境 iOS 设置不同的证书和配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆