ApexDataCollectSDK
示例
要运行示例项目,首先克隆仓库,然后从 Example 目录中运行 pod install
需求
##安装
ApexDataCollectSDK 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'ApexDataCollectSDK'
然后运行 'pod update'
使用方法
准备
在 BuildSettings - 其他链接器标志中添加 ''-ObjC''
![]()
初始化
在你的项目中导入 <ApexDataCollect.h>
必须在SDK初始化后设置所有配置,并且目前apiKey可以为空。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//开启日志输出
[[PEXLogger sharedInstance] setLogLevel:LoggerLevelVerbose];
//初始化
[[APEXDataCollectSDK shareCollector] startCollectorWithServersUrl:@"Url" uuid:@"xxx"];
return YES;
}
配置
您可以使用以下API设置您想要跟踪的事件类型。(所有事件类型在ApexDataCollectSDK.h中列出)
[[APEXDataCollectSDK shareCollector] configAutoTrackEventType:ApexAnalyticEventType_Click | ApexAnalyticEventType_ViewController | ApexAnalyticEventType_AppLaunch | ApexAnalyticEventType_ViewExposureRate];
您还可以设置事件上传时间间隔和事件最大数量。当队列中事件的数量达到最大数量时,队列将自动触发事件上传。
默认上传时间间隔和最大数量分别设置为60秒和100项。
[[APEXDataCollectSDK shareCollector] configUploadTrigerTimeInterval:60];
[[APEXDataCollectSDK shareCollector] configUploadTrigerQueneMaxCount:100];
登录/注销
如果您的应用程序基于帐户系统,您可以使用这些API设置用户的登录状态或注销状态
/**
登入with用户id
*/
- (void)signInWithUID:(NSString*)UID;
/**
登出时调用
*/
- (void)signOut;
作者
long0133, [email protected]
许可证
ApexDataCollectSDK遵循MIT许可证。更多信息请参阅LICENSE文件。