工程配置
在Xcode工程中右键菜单中选择Add files to"…",如下文件添加到工程中,注意勾选"Copy items if needed",
在工程->Targets->Build Phases->Link Binary With Libraries中添加如下系统库
添加相关系统权限。在工程->Targets->Info中添加如下定位权限,
如果需要后台定位,需在IOS 9.0及以后设allowBackgroundLocationUpdates为YES,此时必须保证TARGETS->Capabilities->Background Modes->Location updates处于选中状态
在Targets->Building Settings -> Other Linker Flags中添加 -ObjC,
初始化
在工程的“AppDelegate.m”中引入“#import<QMapKit/QMapKit.h>”和“#import <TNKNavigationKit/TNKNavigationKit.h>”,并配置开发者Key,此步骤为必须。
#import <QMapKit/QMapKit.h>”
#import<TNKNavigationKit/TNKNavigationKit.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// 地图SDK隐私合规接口,同意隐私合规
[[QMapServices sharedServices] setPrivacyAgreement:YES];
[[QFoundationPrivacy singleton] setPrivacyAgreement:YES];
// 导航SDK隐私合规接口,同意隐私合规
[[TNKNaviServices sharedServices] setPrivacyAgreement:YES];
//地图SDK的key配置
[QMapServices sharedServices].APIKey = @"您的key";
//导航SDK的key配置
[TNKNaviServices sharedServices].APIKey = @"您的key"
// 记录设备标识,反馈导航问题时请提供该设备标识以及发生问题的时间
NSString *deviceID = [TNKNaviServices sharedServices].identifier;
}