App Speed in Google Analytics 3.03 iOS SDK

2019-08-13 15:34发布

I've seen a few posts around that previous versions <3.03 doesn't seem to work and I've tried all kinds of things now but this still doesn't appear to be working - nothing appears in the Behaviour/App Speed section of my GA

I'm using the iOS 3.03 GA SDK. Here is my code:

- (void)onLoad:(NSTimeInterval *)loadTime {
    NSNumber *n = [NSNumber numberWithDouble:*loadTime*1000];
    NSLog(@"Time sent = %f ms", [n floatValue]);
    id tracker = [[GAI sharedInstance] defaultTracker];
    [tracker send:[[GAIDictionaryBuilder createTimingWithCategory:@"resources" interval:n     name:@"candidatesLoadTime" label:@"loadTime"] build]];
}

Thanks in advance for any help/advice

1条回答
做自己的国王
2楼-- · 2019-08-13 15:48

I have had the same issue as you for a while, but finally found the solution that worked for me!

It's not documented, as far as I can tell, but the createTimingWithCategory:interval:name:label: method takes the interval parameter as a NSNumber that is required to be contain an integer value

Try replacing the first row of your method with this:

NSNumber *n = [NSNumber numberWithInt:(int)(loadTime*1000)];

Credits go to nh32rg from this answer

查看更多
登录 后发表回答