我已经实现了 3 个步骤。
第 1 步:我已下载谷歌分析库文件并将此文件添加到项目中,
- GAI.h
- GAITrackedViewController.h
- GAITracker.h
- GAITransaction.h
GAITransactionItem.h
libGoogleAnalytics.a
- 核心数据框架
- 系统配置.framework
第 2 步:在 didFinishLaunchingWithOptions
中添加此代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[UIApplication sharedApplication].statusBarHidden = NO;
[GAI sharedInstance].trackUncaughtExceptions = YES;
[GAI sharedInstance].dispatchInterval = 2;
[GAI sharedInstance].debug=YES;
[[GAI sharedInstance] trackerWithTrackingId:@"UA-XXXX-1"];
return YES;
}
第 3 步:在我的 HomeScreen
View 中,启动图像后加载
我写这个,
我已将此 header 更新为:
#import "GAITrackedViewController.h"
@interface BTSHomeViewController : GAITrackedViewController
并且在 BTSHomeViewController.m
- (void)viewDidLoad
{ ...
self.trackedViewName = @"Home";
}
注意:我写了self.trackedViewName = @"Home";
只在第一页不在所有页面都需要写在所有页面中吗?
LOG 也显示此警告:
ld: warning: directory not found for option '-L/Users/Supriya/Desktop/BTS with Analytics/BTS 2.1/BTS/BTS/GoogleAnalytics/Library'
ld: warning: directory not found for option '-F/Users/Supriya/Desktop/BTS with Analytics/BTS 2.1/BTS/../../Documents'
ld: warning: directory not found for option '-F/Users/Supriya/Desktop/BTS with Analytics/BTS 2.1/BTS/../../../Documents'
当我在设备中运行我的代码时写完这个之后,谷歌分析没有显示任何活跃用户。
这是我项目中框架文件夹的快照,我是不是忘记添加任何库了?
: 请帮忙,这是什么错误?
提前致谢。
最佳答案
只是为了确认一下,但是您已经为移动应用程序使用了跟踪 ID,对吧?为网络应用程序创建的跟踪 ID 在移动应用程序中使用时不会为您提供任何信息。
一旦在 App Delegate 中完成了初始设置,就可以像这样轻松地完成跟踪 -
[[[GAI sharedInstance] defaultTracker] trackView:@"Screen name"];
关于iphone - 谷歌分析不工作 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18593820/