// // AMapWrapper.swift // ylgamehall // // 高德定位 SDK 启动注册。iOS 14+ 隐私合规必走 3 步: // updatePrivacyShow → updatePrivacyAgree → apiKey // 少一步定位接口直接拒绝(errorCode 7 KEY 校验失败)。 // // APIKey 沿用 msext APIKey.h:14(与 Bundle ID com.skyapp.ylgamehall 绑死)。 // // ⚠️ canImport(AMapFoundationKit) 守卫:在 Vendor/AMap/*.framework 尚未在 Xcode // 添加到 Target Frameworks 之前,本文件编译为 no-op。 // import Foundation #if canImport(AMapFoundationKit) import AMapFoundationKit #endif @MainActor public enum AMapWrapper { /// 高德 APIKey(沿用 msext APIKey.h:14,绑死 Bundle ID com.skyapp.ylgamehall) public static let apiKey = "b0d4a8e3fcbbcc0dd96283b7df6a4494" /// 启动注册:在 AppDelegate.didFinishLaunchingWithOptions 调用一次。 /// 必须按 iOS 14+ 隐私合规顺序:updatePrivacyShow → updatePrivacyAgree → apiKey public static func bootstrap() { #if canImport(AMapFoundationKit) AMapLocationServices.updatePrivacyShow(.didShow, privacyInfo: .didContain) AMapLocationServices.updatePrivacyAgree(.didAgree) AMapServices.shared().apiKey = apiKey #else // SDK 未链接:no-op #endif } } #if canImport(AMapFoundationKit) private typealias AMapLocationServices = AMapServices #endif