Google Analytics for iOS 不调度事件
我正在使用最新的 SDK 版本以及注册和发送页面视图的基本代码:
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-MY_ACCOUNT_ID-1"
dispatchPeriod:10
delegate:self];
NSError *error;
if (![[GANTracker sharedTracker] trackPageview:@"/firstpage"
withError:&error]) {
NSLog(@"tracker failed: %@",error);
}
但是,事件不是从设备或模拟器调度的。也没有错误。当我打开调试标志时,我可以看到以下内容:
dispatch called
dispatching 4 events
[after 10 seconds]
dispatch called
...dispatcher was busy
[after 10 seconds]
dispatch called
...dispatcher was busy
我的委托方法从未被调用:
- (void)trackerDispatchDidComplete:(GANTracker *)tracker
eventsDispatched:(NSUInteger)eventsDispatched
eventsFailedDispatch:(NSUInteger)eventsFailedDispatch{
NSLog(@"success: %d failures: %d",eventsDispatched,eventsFailedDispatch);
}
- 我尝试创建一个新的发布者 ID,但它也没有帮助。
- 我的设备和模拟器确实有互联网连接,
- 我在尝试之前删除了该应用程序。
- 我玩了调度周期 - 将其设置为 -1 并手动调用调度
没有任何帮助.... :(
我现在已经为此苦苦挣扎了一天...我怎样才能让它工作?
I'm using the latest SDK version, and the basic code to register and send a page view:
[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-MY_ACCOUNT_ID-1"
dispatchPeriod:10
delegate:self];
NSError *error;
if (![[GANTracker sharedTracker] trackPageview:@"/firstpage"
withError:&error]) {
NSLog(@"tracker failed: %@",error);
}
However the events are not dispatched from the device or simulator. There are no errors as well. When i turn on the debug flag, i can see the following:
dispatch called
dispatching 4 events
[after 10 seconds]
dispatch called
...dispatcher was busy
[after 10 seconds]
dispatch called
...dispatcher was busy
My delegate method never gets called:
- (void)trackerDispatchDidComplete:(GANTracker *)tracker
eventsDispatched:(NSUInteger)eventsDispatched
eventsFailedDispatch:(NSUInteger)eventsFailedDispatch{
NSLog(@"success: %d failures: %d",eventsDispatched,eventsFailedDispatch);
}
- I tried to create a new publisher ID but it did not help as well.
- I do have internet connection from the device and simulator
- I deleted the app before trying.
- I played with the dispatch period - setting it to -1 and call the dispatch manually
Nothing helped.... :(
I'm struggling with this for a day now... how can i make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对调度员也有同样的问题(“......调度员很忙”)。就我而言,这是因为我在后台正常运行我的应用程序,并且它正在使用调度程序。当我尝试将设备连接到 Xcode 来运行和调试应用程序时,控制台向我显示了该消息。所以解决方案很简单:
就是这样。
I had the same problem with the dispatcher ("...dispatcher was busy"). In my case, it was because I had run my app normally in the background, and it was using the dispatcher. When I tried to connect the device to Xcode to run and debug the app, the console showed me that message. So the solution was easy:
That's it.
您可以在调用 GANTracker 后进行手动调度,如下所示:
[[GANTracker共享Tracker]调度];
它工作得很好
you can put after calling the GANTracker a manual dispatch like that:
[[GANTracker sharedTracker] dispatch];
and it work perfectly