Google AnalyticsAPI v3未知错误。 createEventWithCategory:不编译

时间:2013-08-28 22:51:34

标签: google-analytics

GAIDictionaryBuilder设置forKey:GAISessionControl错误读取:值的键表示它不符合代码。

GAIDictionaryBuilder *dictionary = [GAIDictionaryBuilder createEventWithCategory:@"UX" action:@"App started" label:nil value:nil];
[dictionary setValue:@"start" forKey:kGAISessionControl];
[[GAI sharedInstance].defaultTracker send:dictionary.build];

我直接从他们的网站上关注Google的文档,&仍然不知道错误来自哪里? https://developers.google.com/analytics/devguides/collection/ios/v3/migration#setting-data

1 个答案:

答案 0 :(得分:0)

Google Analytics文档存在错误(与通常一样)。我通过将“setValue:”替换为“set:”

来消除错误

自:     [字典setValue:@“start”forKey:kGAISessionControl];

于:     [字典集:@“start”forKey:kGAISessionControl];

现在完美运作。

GAIDictionaryBuilder *dictionary = [GAIDictionaryBuilder createEventWithCategory:@"UX" action:@"App started" label:nil value:nil];
[dictionary setValue:@"start" forKey:kGAISessionControl];
[[GAI sharedInstance].defaultTracker send:dictionary.build];