开发者

Why does GANTracker outputs an error "GANTracker.m" not found?

开发者 https://www.devze.com 2022-12-31 05:44 出处:网络
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.

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 someth开发者_C百科ing 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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消