SDK repo for the AppAdhoc iOS SDK binary and Cocoapods install.
We support all build targets for iOS 8.0 and above. Enable Bitcode, and support ARC.
- 在 Podfile 中添加
pod 'AdhocSDK'
. - 执行
pod install
.
- 官方下载最新版SDK.
- 将下载得到的
AdhocSDK.framework
文件添加到指定的工程. - 添加编译参数
-ObjC
. - 必要链接库:
- Security.framework
- CFNetwork.framework
- CoreTelephony.framework
- AdSupport.framework
- AVFoundation.framework
- libsqlite3.tbd
- libicucore.tbd (若SDK支持可视化须链接)
- SDK调试页面有扫码功能,须授权相机访问:
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
- SDK将设备ID存储在本地Keychain中,为保证数据准确,须启用:
Target -> Capabilities -> Keychain Sharing -> ON
- SDK的初始化操作须在
@selector(application:didFinishLaunchingWithOptions:)
中执行:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
AdhocSDKConfig *config = [AdhocSDKConfig defaultConfig];
config.appKey = @"ADHOC_xxx"; //必填项,通过官网申请得到
config.enableDebugAssist = YES; //显示调试按钮,用于开发调试
config.crashTrackEnabled = YES; //统计崩溃次数
config.sessionTrackEnabled = YES; //统计APP访问次数
config.durationTrackEnabled = YES; //统计访问时长
config.reportImmediatelyEnabled = YES; //时时上报开关
[AdhocSDK startWithConfigure:config options:launchOptions];
//sth.
return YES;
}
- 在实验页面,获取后台设置的试验变量,根据取值的不同,进行不同到实验操作:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//获取Boolean类型的试验变量isNewHomePage的值
BOOL isNewHomePage = [[AdhocSDK getFlag:@"isNewHomePage" default:@(NO)] boolValue];
if (isNewHomePage) {
//跳转至新首页
} else {
//跳转至新旧首页
}
}
- 用户需要在相关的页面事件里上传指定的实验指标,用以判断实验的好坏:
- (IBAction)btnClicked:(id)sender {
[AdhocSDK track:@"clickTimes" value:@(1)];
}