如何在ios swift项目中为dev n prod使用两个不同的GoogleService-info.plist文件? [英] How to use two different GoogleService-info.plist file in ios swift project for dev n prod?

查看:163
本文介绍了如何在ios swift项目中为dev n prod使用两个不同的GoogleService-info.plist文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用两个不同的GoogleService-info.plist来处理dev和prod构建,目前我只是通过在编辑方案中更改构建配置来分离dev和prod,但现在我需要有两个不同的。 dev和prod的plist文件,用于处理谷歌分析,pushwoosh等,

I need to use two different GoogleService-info.plist for working with dev and prod builds, currently I'm separating dev and prod by just changing "build configuration" in edit scheme, but now I need to have two different .plist files for dev and prod for working with google analytics, pushwoosh etc,

推荐答案

对于这种情况,你需要使用不同的目标与diff项目中的包ID为开发产品

之后您可以链接 GoogleService-info.plist 用于此目标。而且我建议在项目目录中创建不同的文件夹
查看图片。您首先创建目标产品开发

For this case you need use different Targets with diff bundle id in project for Dev and Prod.
After that you will can link GoogleService-info.plist for this targets. And also I recommend create different folders in project directory Look at pictures. The first you create targets Prod and Dev

在项目字典中创建差异文件夹后,我们称之为 GoogleProd GoogleDev 并复制。 plist 文件来区分文件夹并拖动到项目。第一个文件需要链接 TestProd目标

After create diff folders in project dict let's call them GoogleProd and GoogleDev and copy your .plist file to diff folders and drag to project. First file you need link with TestProd target

第二个文件链接 TestDev目标

最终的项目目录如下所示

The final project directory will look like

这篇关于如何在ios swift项目中为dev n prod使用两个不同的GoogleService-info.plist文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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