Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ios中使用google Analytics,而不扩展所有库中的库GAITrackedViewController_Ios_Objective C - Fatal编程技术网

如何在ios中使用google Analytics,而不扩展所有库中的库GAITrackedViewController

如何在ios中使用google Analytics,而不扩展所有库中的库GAITrackedViewController,ios,objective-c,Ios,Objective C,我希望这个库不是扩展到我所有的类,而是扩展到所有类 @界面ViewController:GAITrackedViewController您不应该在每个类中扩展它。您只需在appDelegate中注册GAITracker,然后从ViewController内部向其发送事件。它是一个单例,所以您所要做的就是导入它并在每个要从中发送事件的viewController中调用defaultTracker 在AppDelegate中的应用程序内部:使用选项完成启动。m: GAI sharedInstance

我希望这个库不是扩展到我所有的类,而是扩展到所有类


@界面ViewController:GAITrackedViewController

您不应该在每个类中扩展它。您只需在appDelegate中注册
GAITracker
,然后从ViewController内部向其发送事件。它是一个单例,所以您所要做的就是导入它并在每个要从中发送事件的viewController中调用defaultTracker

在AppDelegate中的
应用程序内部:使用选项完成启动。m:

GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 120;
[GAI sharedInstance].debug = NO;
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"yourID"];
[[GAI sharedInstance].defaultTracker sendEventWithCategory:@"yourViewControllerName" withAction:@"somethingHappened" withLabel:@"yourLabel" withValue:@1];