Today, I found GoogleAnalytics-iOS-SDK have new 3.0 version in Cocoapods. I upgraded and I try to modified the code of manual screen measurement as below:
今天,我发现google analyticsos - ios - sdk在Cocoapods中有了新的3.0版本。我升级了,我试着修改手动测屏的代码如下:
id tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:kGAIScreenName value:@"Detail View"];
[tracker send:[[GAIDictionaryBuilder createAppView] build]];
However, I always get error about kGAIScreenName is undeclared. Even I add GAIFields.h header, it still not work.
但是,关于kGAIScreenName是未声明的,我总是会犯错误。即使是我添加GAIFields。h页眉,还是不行。
What did I miss?
我错过了什么?
2 个解决方案
#1
86
You have to include two more things:
你必须包括另外两件事:
#import "GAIDictionaryBuilder.h"
#import "GAIFields.h"
Checking what's in GAIFields.h
I can see that kGAIScreenName
is there:
在GAIFields检查什么。h我可以看到kGAIScreenName在那里:
extern NSString *const kGAIScreenName; // synonym for kGAIDescription
Might be important point that the current Google Analytics is in beta, so using the latest downloadable SDK is always a good idea. What I tried and what is working currently for me is Version: 3.0 (August 16, 2013)
.
可能重要的一点是,当前的谷歌分析是测试版,所以使用最新的可下载SDK总是一个好主意。我所尝试的和目前对我有用的是3.0版本(2013年8月16日)。
#2
0
I am using a hardcoded value of @"&cd" for kGAIScreenName and it works perfectly. Found the value in the Measurement Protocol documentation at Google https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking
我对kGAIScreenName使用了@“&cd”的硬编码值,它工作得很好。在谷歌https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking中找到测量协议文档中的值
#1
86
You have to include two more things:
你必须包括另外两件事:
#import "GAIDictionaryBuilder.h"
#import "GAIFields.h"
Checking what's in GAIFields.h
I can see that kGAIScreenName
is there:
在GAIFields检查什么。h我可以看到kGAIScreenName在那里:
extern NSString *const kGAIScreenName; // synonym for kGAIDescription
Might be important point that the current Google Analytics is in beta, so using the latest downloadable SDK is always a good idea. What I tried and what is working currently for me is Version: 3.0 (August 16, 2013)
.
可能重要的一点是,当前的谷歌分析是测试版,所以使用最新的可下载SDK总是一个好主意。我所尝试的和目前对我有用的是3.0版本(2013年8月16日)。
#2
0
I am using a hardcoded value of @"&cd" for kGAIScreenName and it works perfectly. Found the value in the Measurement Protocol documentation at Google https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking
我对kGAIScreenName使用了@“&cd”的硬编码值,它工作得很好。在谷歌https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking中找到测量协议文档中的值