简体   繁体   English

Google Analytics for iOS不会调度事件

[英]Google Analytics for iOS not dispatching events

I'm using the latest SDK version, and the basic code to register and send a page view: 我正在使用最新的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);
}

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. 我试图创建一个新的发布商ID,但它也没有帮助。
  • 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 我玩了调度期 - 将其设置为-1并手动调用调度

Nothing helped.... :( 什么都没有帮助...... :(

I'm struggling with this for a day now... how can i make it work? 我现在正忙着这一天......我怎么能让它发挥作用?

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. 当我尝试将设备连接到Xcode以运行和调试应用程序时,控制台向我显示了该消息。 So the solution was easy: 所以解决方案很简单:

  • Stop the app in Xcode 在Xcode中停止应用程序
  • Close the app in background 在后台关闭应用程序

That's it. 而已。

you can put after calling the GANTracker a manual dispatch like that: [[GANTracker sharedTracker] dispatch]; 您可以在调用GANTracker后手动调度:[[GANTracker sharedTracker] dispatch]; and it work perfectly 它完美地运作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM