Search code examples
iosios7google-analyticsundeclared-identifier

Google Analytics not recognised in one .m file


I've integrated Google Analytics in to my project and it works for all files (maybe 8 other view controllers) except for one file.

Every screen in the viewDidAppear method I call

// defaultTracker originally declared in AppDelegate.m
id tracker = [[GAI sharedInstance] defaultTracker];

// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to nil.
[tracker set:kGAIScreenName
       value:@"Screen Name"];

// manual screen tracking
[tracker send:[[GAIDictionaryBuilder createAppView] build]];

Everyone of them work except for one UITableViewController subclass. My ReportsViewController.m Where I get the following error:

GAI Undeclared Identifier

This would be symptomatic if I didn't include these lines the corresponding .h file but I obviously do.

#import "GAIDictionaryBuilder.h"
#import "GAIFields.h"

What is likely to be causing this error in this file?


Solution

  • Your statement "This would be symptomatic if I didn't include these lines the corresponding .h file but I obviously do." is inaccurate.

    You didn't include GAI.h.