Batch Segment Integration
为 analytics-ios 提供的 Batch.com 集成。
安装
要安装 Segment-Batch 分析集成,只需将以下行添加到您的 CocoaPods Podfile
:
pod 'Segment-Batch'
使用方法
添加依赖项后,您必须使用我们的 SDK 注册集成。为此,将 Google Analytics 集成导入您的 AppDelegate
#import <Segment-Batch/SEGBatchIntegrationFactory.h>
并添加以下行
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:@"MySegmentWriteKey"];
[config use:[SEGBatchIntegrationFactory instance]];
[SEGAnalytics setupWithConfiguration:config];
或者,在 Swift 中
@import Segment_Batch
[...]
let segConfig = SEGAnalyticsConfiguration(writeKey: "MySegmentWriteKey")
segConfig.use(SEGBatchIntegrationFactory.instance())
SEGAnalytics.setup(with: segConfig)
注意:如果您之前使用了 "StaticLibWorkaround" subspec,请从现在起使用标准 spec(需要 Cocoapods 1.4.0)。该解决方案不再需要。
禁用配置和启动处理
如果您想禁用远程配置并自行Batch设置批处理,当调用startWithApiKey时,您可以告诉片段集成只关注Analytics。
SEGBatchIntegrationFactory.enableAutomaticStart = false;
注意:此操作对于某些功能(如手动集成)是必需的。