使用不带.plist文件的iOS版Google Analytics(分析) [英] Use Google Analytics for iOS without .plist file

查看:78
本文介绍了使用不带.plist文件的iOS版Google Analytics(分析)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Google的文档(适用于iOS的Google Analytics(分析)),他们希望您下载一些自动生成的.plist文件以配置您的应用.不幸的是,我有多个报告套件(Debug,Release),并且需要根据构建情况进行动态切换.因此,我正在尝试执行以下两项操作之一:

According to Google's documentation (Analytics for iOS), they want you to download some auto-generated .plist file to configure your app. Unfortunately, I have multiple report suites (Debug, Release) and need to switch dynamically depending on the build. So I'm trying to do one of two things:

  1. 是否有一种方法可以完全放弃.plist文件并动态设置所有配置?一个人需要什么价值?

-或-

  1. 我可以更改Google .plist文件中的值以使用项目的用户定义的构建设置中的变量吗?我尝试添加一个名为GOOGLE_ANALYTICS_ID的文件,并在Google .plist文件中通过$ {GOOGLE_ANALYTICS_ID}对其进行引用,但它并不能像我期望的那样替换该值.

您如何根据应用程序是调试"还是发行版"来动态指示您的应用程序发送到不同的报表套件?

How have you dynamically instructed your app to send to different report suites depending on whether your app is Debug or Release?

推荐答案

您应该能够放弃.plist文件并进行如下设置:

You should be able to ditch the .plist file and setting it up like so:

#import "GAI.h"
...
GAI *gai = [GAI sharedInstance];
[gai trackerWithTrackingId:@"your GA id"];
gai.trackUncaughtExceptions = YES;  // optional
gai.logger.logLevel = kGAILogLevelVerbose;  // optional - remove for release

不要使用GGLContext东西,因为那是试图从-plist文件中获取参数.

Don't use the GGLContext stuff since that's trying to get parameters from the -plist file.

这篇关于使用不带.plist文件的iOS版Google Analytics(分析)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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