LeanplumSegment 1.1.4

LeanplumSegment 1.1.4

测试已测试
语言语言 Obj-CObjective C
许可证 Apache-2.0
发布最新版本2020年12月

Andrew FirstBen MartenAlexis OyamaE2 团队Nikola ZagorchevNikola Zagorchev 维护。



 
依赖
Analytics~> 4
Leanplum-iOS-SDK~> 3
 

Leanplum Segment iOS 集成

LeanplumSDK 对 Segment iOS SDK 的集成。

安装

要安装 Leanplum Segment 集成,只需将此行添加到您的 CocoaPods Podfile 中

pod 'LeanplumSegment', '~> 1.1.3'

就是这样!现在您可以使用 Segment SDK,同时还可以使用 Leanplum SDK 的 高级功能

用法

导入 LeanplumSegment 集成

#import <LeanplumSegment/SEGLeanplumIntegrationFactory.h>

将以下行添加到您的 AppDelegate 中

NSString *const SEGMENT_WRITE_KEY = @" ... ";
SEGAnalyticsConfiguration *config =
    [SEGAnalyticsConfiguration configurationWithWriteKey:SEGMENT_WRITE_KEY];
[config use:[SEGLeanplumIntegrationFactory instance]];
[SEGAnalytics setupWithConfiguration:config];

现在您可以使用 Segment,就像您过去一样,例如

[[SEGAnalytics sharedAnalytics] track:@" ... "];

注意:不需要显式调用 Leanplum.start,因为 LeanplumIntegration 中已经调用了它。

此外,您还可以使用 Leanplum 的高级功能。一旦 Leanplum SDK 成功注册,Segment 会发布一个 NSNotification,因此请注册它

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[...]
  [[NSNotificationCenter defaultCenter]
      addObserver:self
         selector:@selector(segmentIntegrationDidStart)
             name:SEGAnalyticsIntegrationDidStart
           object:LPLeanplumSegmentKey];
}

- (void)segmentIntegrationDidStart {
  [Leanplum onVariablesChanged:^{
      [...]
  }];
}

示例

我们包含了一个示例应用程序。

  1. 在示例项目中安装CocoaPods: cd Example && pod install
  2. 要运行示例应用程序 open LeanplumSegment.xcworkspace
  3. 选择并运行目标 LeanplumSegment_Example

测试

我们为集成包含单元测试。

  1. 要运行单元测试 open LeanplumSegment.xcworkspace
  2. 选择并测试目标 LeanplumSegment_Tests

安装特定版本的 SDK

默认情况下,此集成会拉取 Leanplum SDK 和 Segment SDK 的最新版本。如果您想使用特定版本,只需直接在 podfile 中指定所需版本即可。

pod 'Analytics', '3.0.1'
pod 'Leanplum-iOS-SDK', '1.2.23'

部署到 CocoaPods

  1. 从 develop 分支检出新的发布分支
git flow release start "NEW_VERSION"
  1. 运行版本升级脚本
./bump_version.sh OLD_VERSION NEW_VERSION
  1. 在 Example 项目中运行单元测试。
  2. 验证库
pod lib lint --use-libraries --verbose
pod spec lint --use-libraries --verbose
  1. 完成发布
git flow release finish "NEW_VERSION"
git push
git checkout master
git push
  1. 发布到 CocoaPods(注意,一旦发布后无法撤销!)
pod trunk push --use-libraries

许可证

查看 LICENSE 文件。