使用带有两个目标的Google登录 [英] Using Google Sign-in with two targets

查看:126
本文介绍了使用带有两个目标的Google登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我无法弄清楚的问题,我到处搜索过。



我最近在我的应用中添加了Google登录,这是但是,由于我使用多个目标来部署我的应用程序的辅助版本,因此第二个分发包标识符无法添加到GoogleService-Info.plist中。 Google登录代码按名称引用此文件,因此我不能像我为其他plist所做的那样简单地更改每个应用版本的名称。



<我尝试在每个方案中添加环境变量,并在plist中使用$ {BUNDLE_ID}根据所选方案进行更改,但它也不起作用。有什么我想念的吗?具有多个目标的工作空间应该如何为每个目标使用具有不同变量的相同plist?



谢谢!



编辑:尝试使用XCConfig文件将plist中的静态值替换为编译时变量。没有运气,可能是因为我认为Google登录正在直接访问该文件。我假设任何使用Google登录的用户都有一个具有多个目标(广告支持与付费高级版)的应用必须解决这个问题。请帮忙。

解决方案

我遇到了同样的问题,我找到了一个非常简单的解决方案。



只需复制 GoogleServices-Info.plist 并将其放在不同的文件夹中。该文件夹必须是物理上不同的文件夹,因为文件系统不会在同一文件夹中接受相同的文件名。因此,在finder中创建一个真实的文件夹并将其添加到XCode,不要使用XCode组。



然后根据每个plist文件更改目标成员资格。而已!






I have a problem that I can't figure out, and I've searched everywhere.

I recently added Google Sign-in to my app, and it's working fine on the main target, however, since I'm using multiple targets to deploy a secondary version of my app, the second bundle identifier can't get added to "GoogleService-Info.plist". The Google sign-in code refers to this file by name, so I can't simply change the name for each version of the app like I've done for other plists.

I've tried adding environment variables to each scheme and using ${BUNDLE_ID} in the plist to change based on the chosen scheme, but it's not working either. Is there something I'm missing? How should a workspace with multiple targets use the same plist with different variables for each target?

Thanks!

Edit: Tried using an XCConfig file to replace the static values in the plist with compile-time variables. No luck, probably because I think Google Sign-in is accessing the file directly. I assume anyone using Google Sign-in with an app that has multiple targets (ad-supported vs. paid premium) must have a way around this. Please help.

解决方案

I had the same problem and I found a pretty simple solution.

Just copy the GoogleServices-Info.plist and put it in a different folder. The folder must be a physically different folder, since the filesystem won't accept same file names in the same folder. So create a real folder in finder and add it to XCode, don't use XCode groups.

Then change the target membership according to each plist file. Thats it!


这篇关于使用带有两个目标的Google登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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