Google Analytics v3“无法连接到服务器”错误

时间:2014-06-10 14:22:52

标签: ios google-analytics

我想在我的应用程序中添加Google Analytics。但我得到“无法连接到服务器”错误。

以下是我如何初始化跟踪器:

// Optional: automatically send uncaught exceptions to Google Analytics.
[GAI sharedInstance].trackUncaughtExceptions = YES;

// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
[GAI sharedInstance].dispatchInterval = 20;

// Optional: set Logger to VERBOSE for debug information.
[[[GAI sharedInstance] logger] setLogLevel:kGAILogLevelVerbose];

// Initialize tracker. Replace with your tracking ID.
[[GAI sharedInstance] trackerWithTrackingId:@"UA-51794870-1"];

并在MainViewController.h中添加:

@interface MainViewController : GAITrackedViewController
在MainVIewController.m中

我添加了:

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setScreenName:@"Main screen"];
}

以下是一些日志:

2014-06-10 17:08:34.690 OneKr[2643:3503] VERBOSE: GoogleAnalytics 3.07 -[GAIRequestBuilder requestGetUrl:payload:] (GAIRequestBuilder.m:195): building URLRequest for https://ssl.google-analytics.com/collect
2014-06-10 17:08:34.691 OneKr[2643:3503] VERBOSE: GoogleAnalytics 3.07 -[GAIBatchingDispatcher dispatch] (GAIBatchingDispatcher.m:509): Sending hit(s) GET: https://ssl.google-analytics.com/collect?av=1.0&cd=%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D1%8B%D0%B9+%D1%8D%D0%BA%D1%80%D0%B0%D0%BD&t=appview&ul=ru&_u=.etno&tid=UA-51794870-1&cid=89de9e5c-6d1d-4b63-b4af-82f072392f15&sr=320x568&v=1&aid=i.soft.OneKr&_v=mi3.0.7&an=OneKr&ht=1402403711687&qt=5603003&z=6292601897416045478
2014-06-10 17:08:34.699 OneKr[2643:60b] INFO: GoogleAnalytics 3.07 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:155): Dispatch error: Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo=0x17ee7620 {NSErrorFailingURLStringKey=https://ssl.google-analytics.com/collect?av=1.0&cd=%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D1%8B%D0%B9+%D1%8D%D0%BA%D1%80%D0%B0%D0%BD&t=appview&ul=ru&_u=.etno&tid=UA-51794870-1&cid=89de9e5c-6d1d-4b63-b4af-82f072392f15&sr=320x568&v=1&aid=i.soft.OneKr&_v=mi3.0.7&an=OneKr&ht=1402403711687&qt=5603003&z=6292601897416045478, NSErrorFailingURLKey=https://ssl.google-analytics.com/collect?av=1.0&cd=%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D1%8B%D0%B9+%D1%8D%D0%BA%D1%80%D0%B0%D0%BD&t=appview&ul=ru&_u=.etno&tid=UA-51794870-1&cid=89de9e5c-6d1d-4b63-b4af-82f072392f15&sr=320x568&v=1&aid=i.soft.OneKr&_v=mi3.0.7&an=OneKr&ht=1402403711687&qt=5603003&z=6292601897416045478, NSLocalizedDescription=Could not connect to the server., NSUnderlyingError=0x17ee7410 "Could not connect to the server."}

注意:始终有互联网连接。

0 个答案:

没有答案