我一直在使用谷歌的Analytics SDK v2beta3并且一切正常,但是当应用程序离开活动状态时我无法手动调度.(fyi,对于我的应用程序,我需要预留电池电量,所以我只使用'[[GAI sharedinstance] dispatch]'来在用户完成应用程序时发送我的事件数据.)
我已经尝试了几件事,但是在跟踪调度到达并在跟踪期间运行时,它似乎没有做任何事情......没有日志输出(我打开了调试模式)并且没有上传数据.它应该最低限度报告 "Google分析2.0b3 - [GAIDispatcher initiateDispatch:retryNumber:]没有未决命中(GAIDispatcher.m:479)DEBUG." 或者我会想到的那种东西.但是日志中没有任何内容,也没有发送数据.
相反,当应用程序从后台恢复时,会发送匹配,然后我会在控制台上看到所有调试语句,数据会成功发送到我的Google Analytics帐户.
以下是我的代码......
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
// set up Google Analytics tracker
[GAI sharedInstance].trackUncaughtExceptions = YES; // automatically track uncaught exceptions with Google Analytics - sent with stack trace.
[GAI sharedInstance].dispatchInterval = -1; // set Google Analytics dispatch off, will do manually when app goes into background.
[GAI sharedInstance].debug = YES; // set debug to YES for extra debugging information.
id<GAITracker> tracker = [[GAI sharedInstance] …Run Code Online (Sandbox Code Playgroud)