在不使用GoogleService-Info.plist的情况下使用Google Service for iOS

时间:2022-04-06 16:52:58

I am able to use both Google SignIn and Analytics using GoogleService-Info.plist.

我可以使用GoogleService-Info.plist同时使用Google SignIn和Google Analytics。

However, to reduce dependency, I want to move the information from the GoogleService-Info.plist into another .plist that contains my other information.

但是,为了减少依赖性,我想将信息从GoogleService-Info.plist移动​​到另一个包含我的其他信息的.plist中。

Would this be possible? If so, how can I do this?

这可能吗?如果是这样,我该怎么做?

2 个解决方案

#1


5  

You can - both libraries allow you to configure them manually. You'll want to drop any references to GGLContext, and just setup the libraries directly:

您可以 - 两个库都允许您手动配置它们。您将要删除对GGLContext的任何引用,并直接设置库:

[GIDSignIn sharedInstance].clientID = @"YOUR_CLIENT_ID";

and

[[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-Y"]; 

You can check the reference docs for Analytics and Sign In for more.

您可以查看分析和登录的参考文档以获取更多信息。

#2


0  

Sure you can. Do not initialise through pList , use instead manual setup using your keys and constants maintained in separate space in your project.

你当然可以。不要通过pList初始化,而是使用在项目的单独空间中维护的键和常量来代替手动设置。

[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
 id newTracker = [[GAI sharedInstance] trackerWithTrackingId:GOOGLE_ANALYTICS_KEY];
[GAI sharedInstance].defaultTracker = newTracker;

#1


5  

You can - both libraries allow you to configure them manually. You'll want to drop any references to GGLContext, and just setup the libraries directly:

您可以 - 两个库都允许您手动配置它们。您将要删除对GGLContext的任何引用,并直接设置库:

[GIDSignIn sharedInstance].clientID = @"YOUR_CLIENT_ID";

and

[[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-Y"]; 

You can check the reference docs for Analytics and Sign In for more.

您可以查看分析和登录的参考文档以获取更多信息。

#2


0  

Sure you can. Do not initialise through pList , use instead manual setup using your keys and constants maintained in separate space in your project.

你当然可以。不要通过pList初始化,而是使用在项目的单独空间中维护的键和常量来代替手动设置。

[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];
 id newTracker = [[GAI sharedInstance] trackerWithTrackingId:GOOGLE_ANALYTICS_KEY];
[GAI sharedInstance].defaultTracker = newTracker;