Braze iOS Segment SDK
Braze 对 analytics-ios 的集成。
安装
Analytics 可以通过 CocoaPods 和 Carthage 获取。
Cocoapods
要使用 Cocoapods 安装 Braze 集成,只需将以下行添加到您的 Podfile
pod "Segment-Appboy"
如果您想要使用 Appboy-iOS-SDK/Core
子规范而不是完整的 Appboy-iOS-SDK
pod,请将您的 Podfile
条目进行编辑:
pod "Segment-Appboy/Core"
Carthage
要通过 Carthage 安装 Braze 集成,请在您的 Cartfile
中添加以下几行
github "segmentio/analytics-ios"
github "appboy/appboy-segment-ios"
github "appboy/appboy-ios-sdk"
然后运行
carthage update
按照标准流程添加 Carthage 构建或检索的框架到您的项目中(见添加框架到应用)
Swift 包管理器
要通过 Swift 包管理器安装 Braze 集成,请按照以下步骤操作
- 选择
文件 > Swift 包 > 添加包依赖
。 - 在搜索栏中输入 https://github.com/Appboy/appboy-segment-ios。根据您的使用情况选择
AppboySegment
或AppboySegmentCore
。 - 在您的应用目标中,在
构建设置 > 其他链接器标志
下添加-ObjC
链接器标志。 - 在 Xcode 菜单中,点击
产品 > 架构 > 修改架构...
- 点击展开
▶️ 旁边的构建
并选择后置操作
。按+
并选择新建运行脚本操作
。 - 在
提供构建设置自
的下拉菜单中,选择您的应用目标。 - 将以下脚本粘贴到打开的空白处
bash "$BUILT_PRODUCTS_DIR/Appboy_iOS_SDK_AppboyKit.bundle/Appboy.bundle/appboy-spm-cleanup.sh"
使用情况
添加依赖后,您必须使用我们的 SDK 注册集成。为此,在您的 AppDelegate 中导入 Braze 集成
#import "SEGAppboyIntegrationFactory.h"
注意:当使用 Swift 包管理器时,您需要使用 import AppboySegment
或 import AppboySegmentCore
来导入 SDK,具体取决于您使用的包。
并添加以下几行
Objective-C
NSString *const SEGMENT_WRITE_KEY = @" ... ";
SEGAnalyticsConfiguration *config = [SEGAnalyticsConfiguration configurationWithWriteKey:SEGMENT_WRITE_KEY];
[config use:[SEGAppboyIntegrationFactory instance]];
[SEGAnalytics setupWithConfiguration:config];
Swift
let SEGMENT_WRITE_KEY = " ... "
let config = SEGAnalyticsConfiguration(writeKey: SEGMENT_WRITE_KEY)
config.use(SEGAppboyIntegrationFactory.instance())
SEGAnalytics.setup(with: config)
有关更多信息,请参阅我们的文档。
端点定制
- 您必须通过传递给
startWithApiKey:inApplication:withLaunchOptions:withAppboyOptions:
方法的appboyOptions
参数内的ABKEndpointKey
来设置端点。 - 将值设置为自定义端点URL的授权(例如,
sdk.iad-01.braze.com
,而不是https://sdk.iad-01.braze.com
)。
许可证
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
The MIT License (MIT)
Copyright (c) 2014 Segment, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.