iOS开发交流群:301058503(如果不是开发者,做广告的就不用进了,因为迟早都被踢)
>=3.0版本的接入(适配XCode8.3以上)
-
登录百度地图开放平台,找到iOS的鹰眼轨迹的SDK,下载,然后把BaiduTraceSDK.framework导入工程(选择工程->General ,把SDK拖到Embedded Baniaries)
-
在buidsettings输入bite,选择Enable bite code,值为NO;
-
在plist添加NSLocationAlwaysUsageDescription
-
。。。
-
使用
—1—
#import "BaiduTraceSDK/BaiduTraceSDK.h"
添加代理BTKTraceDelegate, BTKFenceDelegate, BTKTrackDelegate, BTKEntityDelegate
- (void)viewDidLoad {
[super viewDidLoad];
// 使用SDK的任何功能前,都需要先调用initInfo:方法设置基础信息。
BTKServiceOption *sop = [[BTKServiceOption alloc] initWithAK:AK mcode:mcode serviceID:serviceID keepAlive:false];
[[BTKAction sharedInstance] initInfo:sop];
}
—2—开启服务
BTKStartServiceOption *op = [[BTKStartServiceOption alloc] initWithEntityName:entityName];
[[BTKAction sharedInstance] startService:op delegate:self];
服务回调
-(void)onStartService:(BTKServiceErrorCode)error {
NSLog(@"start service response: %lu", (unsigned long)error);//0成功
}
—3—收集轨迹
[[BTKAction sharedInstance] startGather:self];
回调
-(void)onStartGather:(BTKGatherErrorCode)error {
NSLog(@"start gather response: %lu", (unsigned long)error);//0成功,正在收集轨迹
}
—4—结束
[[BTKAction sharedInstance] stopGather:self];
回调
-(void)onStopGather:(BTKGatherErrorCode)error {
NSLog(@"stop gather response: %lu", (unsigned long)error)