views:

231

answers:

1

Hi,

I have used the Google Analytics Tracker in a previous iPhone OS project. Everything was working fine and I copy & pasted the GANTracker Library and the Tracker initialization.

When starting my new project it tells me:

Xcode could not locate source file: GANTracker.m (line: 177)

To tell the truth, I don't know where to start to debug this one.

I have included the library using #import "GANTracker.h".

The error message occurs right within the application didFinishLaunchingWithOptions and does not seem to have any connection to what is really going on. If I set the breakpoint to [window makeKeyAndVisible]; for example and wait a second, it occurs right after that. That makes it look like there is something in the background going on with the GANTracker.

The Tracker itself is created a little later by:

[[GANTracker sharedTracker] startTrackerWithAccountID:@"xx" dispatchPeriod:10 delegate:nil];
[[GANTracker sharedTracker] trackPageview:@"pageview" withError:nil];

Thank you all in advance for your help!

A: 

Found it with some guesswork:

I was assuming that the error parameter can be nil, doing:

[[GANTracker sharedTracker] trackPageview:@"somePageView" withError:nil];

But error can not be nil:

NSError *error;
[[GANTracker sharedTracker] trackPageview:@"somePageView" withError:&error];

This fixed it. Still, this doesn't add up because the crash was not at that line, but it fixed it.

favo
The crash was where GANTracker tried to assign a value to the nil you were passing as error, which we can assume is line 177.
drawnonward
Thank you for taking time to commenting this. But how can this error happen if the line is not beeing called? I have set a breakpoint two lines before and got the same error message?
favo