1、通过CocoaPods安装诸葛
gem install cocoapods
在项目目录下创建Podfile
文件,文件内容为
pod 'Zhuge'
在项目目录下执行以下脚本,CocoaPods会自动下载安装Zhuge SDK,并生成工作区文件
pod install
打开工作区文件*.xcworkspace
,不要打开原来的项目文件*.xcodeproj
open {YOUR-PROJECT}.xcworkspace
2、向AppDelegate.m
文件中添加诸葛启动代码
#import <Zhuge/Zhuge.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[Zhuge sharedInstance] startWithAppKey:@"Your App Key" launchOptions:launchOptions];
}
3、开始追踪用户行为
[[Zhuge sharedInstance] track:@"分享" properties:@{@"渠道":@"微博"}];
4、识别用户身份
[[Zhuge sharedInstance] identify:@"1234" properties:@{@"email":@"[email protected]"}]];
了解更多 完整文档 »