实测三个 SDK(微信 / 高德 / 七牛)链接进 Target 后,暴露出 9 个 Swift 编译错误,逐一修正: 代码侧(5 个 Swift 文件): - AMapWrapper:updatePrivacyShow / updatePrivacyAgree 是 AMapLocationManager 类方法(since 2.8.0),不在 AMapServices 上;改为 AMapLocationManager.* 并补 import AMapLocationKit - BackGameDataHandler:删 `WXApi.delegate = nil`。新版 SDK 2.x 无 static delegate API,delegate 由调用方逐次传给 handleOpenURL/sendAuthReq 并被 SDK 弱引用;WeChatManager singleton 长生命周期不析构,无需 cleanup - QiniuConfig / QiniuTokenSigner:所有 static 成员标 nonisolated,让 actor QiniuUploader 可直接调,无需 await MainActor.run - QiniuUploader:QNUploadManager() 在七牛 SDK 8.x 已 kQNDeprecated,改用 initWithConfiguration: + defaultConfigurationV2 工程侧(pbxproj,Xcode UI 自动写入): - 新 Frameworks group 容纳 Vendor/WechatSDK / Vendor/AMap 引用 - WechatOpenSDK-NoPay.xcframework:Embed & Sign(动态库) - AMapFoundationKit / AMapLocationKit:Do Not Embed(静态 fat .framework) BuildProject 验证:Swift 全部编译通过;剩余 AMap fat framework arch 冲突 (M Mac iOS-simulator)是工程配置选择,下个 commit 处理。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
44 lines
1.5 KiB
Swift
44 lines
1.5 KiB
Swift
//
|
||
// 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
|
||
#if canImport(AMapLocationKit)
|
||
import AMapLocationKit
|
||
#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
|
||
/// 注意:updatePrivacyShow / updatePrivacyAgree 是 AMapLocationManager 的类方法
|
||
/// (since 2.8.0),不在 AMapServices 上。
|
||
public static func bootstrap() {
|
||
#if canImport(AMapFoundationKit) && canImport(AMapLocationKit)
|
||
AMapLocationManager.updatePrivacyShow(.didShow, privacyInfo: .didContain)
|
||
AMapLocationManager.updatePrivacyAgree(.didAgree)
|
||
AMapServices.shared().apiKey = apiKey
|
||
#else
|
||
// SDK 未链接:no-op
|
||
#endif
|
||
}
|
||
}
|