适用于 iOS 的 Google Analytics(分析)不调度事件 [英] Google Analytics for iOS not dispatching events
问题描述
我使用的是最新的 SDK 版本,以及注册和发送页面视图的基本代码:
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);
}
- 我尝试创建一个新的发布商 ID,但也无济于事.
- 我有设备和模拟器的互联网连接
- 我在尝试之前删除了该应用.
- 我使用了调度周期 - 将其设置为 -1 并手动调用调度
- 在 Xcode 中停止应用程序
- 在后台关闭应用
没有任何帮助....:(
Nothing helped.... :(
我现在为此苦苦挣扎了一天……我该如何让它发挥作用?
I'm struggling with this for a day now... how can i make it work?
推荐答案
我遇到了与调度员相同的问题(...调度员正忙").就我而言,这是因为我在后台正常运行我的应用程序,并且它正在使用调度程序.当我尝试将设备连接到 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:
就是这样.
这篇关于适用于 iOS 的 Google Analytics(分析)不调度事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!