73 lines
1.5 KiB
Objective-C
73 lines
1.5 KiB
Objective-C
//
|
||
// AMapNavSDKManager.m
|
||
// Pods
|
||
//
|
||
// Created by admin on 2026/2/10.
|
||
//
|
||
|
||
#import "AMapNavSDKManager.h"
|
||
#import "AMapPrivacyUtility.h"
|
||
|
||
#import <AMapFoundationKit/AMapFoundationKit.h>
|
||
|
||
@interface AMapNavSDKManager ()
|
||
@property (nonatomic , strong , readwrite) UIViewController * targetVC;
|
||
@end
|
||
|
||
@implementation AMapNavSDKManager
|
||
|
||
+ (instancetype)sharedManager {
|
||
static AMapNavSDKManager *manager = nil;
|
||
static dispatch_once_t onceToken;
|
||
dispatch_once(&onceToken, ^{
|
||
manager = [[AMapNavSDKManager alloc] init];
|
||
});
|
||
return manager;
|
||
}
|
||
|
||
- (instancetype)init {
|
||
self = [super init];
|
||
if (self) {
|
||
_targetVC = [ARoutePlaneController new];
|
||
}
|
||
|
||
return self;
|
||
}
|
||
|
||
|
||
|
||
- (void)configWithKey:(NSString*)key {
|
||
if (1) {
|
||
/*
|
||
* 调用隐私合规处理方法
|
||
*/
|
||
// [AMapPrivacyUtility handlePrivacyAgreeStatusIn:_targetVC];
|
||
//
|
||
// 初始化高德导航SDK
|
||
[self configureAPIKey:key];
|
||
|
||
}
|
||
}
|
||
|
||
- (UIViewController *)targetVC {
|
||
return _targetVC;
|
||
}
|
||
|
||
#pragma mark - private
|
||
- (void)configureAPIKey:(NSString*)key {
|
||
if ([key length] == 0)
|
||
{
|
||
NSString *reason = [NSString stringWithFormat:@"apiKey为空,请检查key是否正确设置。"];
|
||
|
||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:reason delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
|
||
|
||
[alert show];
|
||
}
|
||
[AMapServices sharedServices].enableHTTPS = YES;
|
||
[AMapServices sharedServices].apiKey = (NSString *)key;
|
||
}
|
||
|
||
|
||
|
||
@end
|