最后更新时间:2025-03-26
提供两种集成方式供iOS开发者选择:
在工程的 Podfile 里面添加以下代码
pod 'TencentNavKit', '6.12.0'
pod 'libwebp'
TencentNavKit最新版本请参考:https://lbs.qq.com/mobile/ios_nav_sdk/download/naviSDK
i. 将如下Framework以及资源Bundle加入Xcode工程中
ii. 在工程->Targets->Build Phases->Link Binary With Libraries中添加如下系统库 * CoreMotion.framework * libc++.tbd * libsqlite3.0.tbd
iii. 在Targets->Building Settings -> Other Linker Flags中添加 -ObjC
iv. 导航SDK依赖libwebp,请引入libwebp
Privacy - Location Always Usage Description
Privacy - Location Always and When In Use Usage Description
Privacy - Location When In Use Usage Description
allowBackgroundLocationUpdates为YES,此时必须保证TARGETS->Capabilities->Background Modes->Location updates处于选中状态在工程的“AppDelegate.m”中引入QMapKit.h和TencentNavKit.h,并配置开发者Key,此步骤为必须。
// 引入QMapKit.h和TencentNavKit.h
#import <QMapKit/QMapKit.h>
#import<TencentNavKit/TencentNavKit.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// 地图SDK隐私合规接口,同意隐私合规
[[QMapServices sharedServices] setPrivacyAgreement:YES];
// 导航SDK隐私合规接口,同意隐私合规
[[TNKNavServices sharedServices] setPrivacyAgreement:YES];
//地图SDK的key配置
[QMapServices sharedServices].APIKey = @"您的key";
//导航SDK的key配置
[TNKNavServices sharedServices].key = @"您的key";
// 记录设备标识,反馈导航问题时请提供该设备标识以及发生问题的时间
NSString *deviceID = [TNKNavServices sharedServices].identifier;
return YES;
}
有帮助
没帮助