小编Nit*_*tin的帖子

Google Analytic [[GANTracker sharedTracker] stopTracker];

现在我在我的Ipad应用程序中使用Google Analytic来跟踪我在我的所有viewController和按钮点击事件的代码下面实现的网页浏览和事件,但是当我的视图消失时,我的应用程序停止/崩溃.我[[GANTracker sharedTracker] stopTracker];在viewWillDisappear方法中放置了stopTracker代码.

[[GANTracker sharedTracker] startTrackerWithAccountID:@"UA-12345678-1"
                                       dispatchPeriod:kGANDispatchPeriodSec
                                             delegate:nil];

NSError *error;
if (![[GANTracker sharedTracker] setCustomVariableAtIndex:1
                                                     name:@"iPad3"
                                                    value:@"iv1"
                                                withError:&error]) {
    // Handle error here
}

if (![[GANTracker sharedTracker] trackEvent:@"my_category"
                                     action:@"my_action"
                                      label:@"my_label"
                                      value:-1
                                  withError:&error]) {
    // Handle error here
}

if (![[GANTracker sharedTracker] trackPageview:@"/app_entry_point_prashant"
                                     withError:&error]) {
    // Handle error here
}
[[GANTracker sharedTracker] stopTracker];
Run Code Online (Sandbox Code Playgroud)

google-analytics google-analytics-api

5
推荐指数
1
解决办法
434
查看次数