开发者

iOS Google Analytics crash at start up, randomly

开发者 https://www.devze.com 2023-03-28 12:08 出处:网络
I’m encountering a random Google Analytics crash issue. This issue happens when my App starts and trying to initial GANTracker.

I’m encountering a random Google Analytics crash issue. This issue happens when my App starts and trying to initial GANTracker. It happens randomly, very hard to reproduce. I wonder if there is anything I missed or I should avoid in implementing GA initial.

Here is my GANTracker initial code:

#define GAKey @“UA-xxxxxx-x"

static const NSInteger kGANDispatchPeriodSec = 10;
[[GANTracker sharedTracker] startTrackerWithAccountID:GAKey
                                       dispatchPeriod:kGANDispatchPeriodSec
                                             delegate:nil];

While I’m starting up this, my code is doing some Synchronous network activity in another second开发者_StackOverflowary thread using the method.

[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]

And here is the crash log, hope it helps

-[GANTracker startTrackerWithAccountID:dispatchPeriod:delegate:]
-[GANPersistentEventStore init]
-[GANPersistentEventStore initWithPath:]
-[GANPersistentEventStore setupStatements]
-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
+[NSException raise:format:arguments:]

Any suggestion would be appreciated!


UPDATE: According to Google's issues DB, this is allegedly fixed in v1.4 of GANTracker: http://code.google.com/p/analytics-issues/issues/detail?id=162 http://code.google.com/mobile/analytics/download.html


I'm getting same crash on GANTracker startup with one of these two errors:

NSInternalInconsistencyException: Error: Failed to prepare select session statement NSInternalInconsistencyException: Error: Failed to prepare update timestamp statement

stack trace to the assert (different method than the OP):

- [GANTracker startTrackerWithAccountID:dispatchPeriod:delegate:]
- [GANPersistentEventStore init]
- [GANPersistentEventStore initWithPath:]
- [GANPersistentEventStore initializeSession]
- [NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]

it looks like an unhandled error when creating the googleanalytics.sql file, during sqlite3_prepare_v2

This is recurring for some of my users on IOS4.3.3 and also occurs randomly for IOS4.2.1 I have the same dispatch period as the OP. cannot repro this on my own simulator/device.

I wish that google analytics would release their source code so i could add some error handling when the sqlite file cannot get created or the prepare statement fails.

There's a post on the GA forum here with same error: http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=20107fa00aae4f08&hl=en

this could be the same issue using sqlite3_prepare_v2 : http://www.iphonedevsdk.com/forum/iphone-sdk-development/2540-sqlite-method-sqlite3_prepare_v2-failing.html

0

精彩评论

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