将景区选择与权限申请流程接入首页路由,集成高德 SDK 用于真机构建,并通过 Podfile post_install 钩子保证 arm64 模拟器可编译。 Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.0 KiB
Swift
37 lines
1.0 KiB
Swift
//
|
||
// AMapBootstrap.swift
|
||
// suixinkan
|
||
//
|
||
// 高德 SDK 初始化入口。真机构建时 AMAP_ENABLED 生效;模拟器构建时不链接 AMap。
|
||
//
|
||
|
||
import Foundation
|
||
|
||
#if AMAP_ENABLED
|
||
import AMapFoundationKit
|
||
import AMapLocationKit
|
||
import AMapSearchKit
|
||
import MAMapKit
|
||
|
||
enum AMapBootstrap {
|
||
/// 在 App 启动时调用一次。将 `apiKey` 替换为高德控制台申请的 Key。
|
||
static func configure(apiKey: String) {
|
||
guard !apiKey.isEmpty else { return }
|
||
|
||
AMapServices.shared().apiKey = apiKey
|
||
AMapServices.shared().enableHTTPS = true
|
||
|
||
AMapSearchAPI.updatePrivacyShow(.didShow, privacyInfo: .didContain)
|
||
AMapSearchAPI.updatePrivacyAgree(.didAgree)
|
||
MAMapView.updatePrivacyShow(.didShow, privacyInfo: .didContain)
|
||
MAMapView.updatePrivacyAgree(.didAgree)
|
||
AMapLocationManager.updatePrivacyShow(.didShow, privacyInfo: .didContain)
|
||
AMapLocationManager.updatePrivacyAgree(.didAgree)
|
||
}
|
||
}
|
||
#else
|
||
enum AMapBootstrap {
|
||
static func configure(apiKey: String) {}
|
||
}
|
||
#endif
|