# AMPSAdSDK **Repository Path**: adscope/amps-ad-sdk ## Basic Information - **Project Name**: AMPSAdSDK - **Description**: AdScope 聚合管理平台 - **Primary Language**: Objective-C - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-07-19 - **Last Updated**: 2026-11-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AMPSAdSDK (iOS) AdScope 聚合广告管理平台。兼容多家广告形式,一键式集成多家广告 SDK,可自定义渠道接入,统一管理多个渠道。 本仓库同时提供两种分发方式:**CocoaPods**(podspec)与 **Swift Package Manager**(Package.swift)。 --- ## 一、Swift Package Manager ### Xcode 接入 1. File → Add Package Dependencies… → **Add Package…** 2. 填入仓库地址: ``` https://gitee.com/adscope/amps-ad-sdk.git ``` 3. Version 选择 `5.1.4` 4. **⚠️ 对话框底部的「Add to target(s)」必须勾选你的 App target** —— 不勾只是「引用」了包,没有「使用」,target 里不会有它的头搜索路径, `#import ` 会报 file not found。 5. 业务代码中引用: ```objc #import #import ``` > 自查包是否真的挂上了: > ```bash > grep -c "XCSwiftPackageProductDependency" <工程>.xcodeproj/project.pbxproj # 应 ≥ 1 > ``` ### Package.swift 接入 ```swift dependencies: [ .package(url: "https://gitee.com/adscope/amps-ad-sdk.git", from: "5.1.4") ], targets: [ .target(name: "MyApp", dependencies: [ .product(name: "AMPSAdSDK", package: "amps-ad-sdk") ]) ] ``` > 本包同时提供聚合 SDK 与基础库(AdScopeFoundation)两个模块,引入一个 product 即可。 ### 注意事项 - 消费端 App target 的 Other Linker Flags 建议加 `-ObjC`(静态库链接时 Category 可能被裁剪)。 - 本包最低支持 iOS 12。 - 换了版本号后若仍解析到旧版本,清一下缓存: ```bash rm -f <你打开的 workspace>/xcshareddata/swiftpm/Package.resolved rm -rf ~/.swiftpm/cache ~/Library/Caches/org.swift.swiftpm \ ~/Library/Developer/Xcode/DerivedData/*/SourcePackages ``` --- ## 二、CocoaPods ```ruby pod 'AMPSAdSDK', :git => 'https://gitee.com/adscope/amps-ad-sdk.git', :tag => '5.1.3.11' ``` --- ## 三、版本对照 | 通道 | 版本 | tag | |------|------|-----| | SPM | `5.1.4` | `5.1.4`(三段 semver) | | CocoaPods | `5.1.3.11` | `5.1.3.11`(四段) | > SPM 版本号必须是三段 semver,pod 版本不限 —— 两个通道各用自己的 tag。 > 仓库里大量四段历史 tag(如 `5.1.3.10`)会被 SPM 自动忽略,不影响解析。 --- ## 四、产物说明 ``` AMPSAdSDK.xcframework/ # CocoaPods 通道(目录形态) spm-artifacts/AMPSAdSDK.xcframework.zip # SPM 通道 spm-artifacts/AdScopeFoundation.xcframework.zip # SPM 通道(基础库) Package.swift # SPM 清单 ``` zip 必须是干净的(不含 `__MACOSX` 冗余条目),且打包时固定文件时间戳,保证同样产物打出同样 checksum: ```bash cp -R AMPSAdSDK.xcframework /tmp/stage/ find /tmp/stage -exec touch -t 202001010000 {} + (cd /tmp/stage && zip -r -X AMPSAdSDK.xcframework.zip AMPSAdSDK.xcframework) swift package compute-checksum AMPSAdSDK.xcframework.zip # 结果要同步写进 Package.swift ``` **zip 与 `Package.swift` 必须一起提交**——`Package.swift` 里的 checksum 与 zip 一一对应, 只推其中一个会导致 SPM 报 `checksum of downloaded artifact ... does not match`。 > `Package.swift` 里 binaryTarget 的 url 指向**版本 tag**(`raw/5.1.4/...`)而不是 `master/`, > 这样产物与 checksum 才是不可变的一对。