1、应用编译环境升级至 Xcode 12.0 及以上版本
2、升级穿山甲 iOS SDK 3.2.5.0 及以上版本,穿山甲提供了 iOS 14 与 SKAdNetwork 支持
3、将穿山甲的 SKAdNetwork ID 和NSUserTrackingUsageDescription 字段添加到 info.plist 中,以保证 SKAdNetwork 的正确运行
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>238da6jt44.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>22mmun2rn5.skadnetwork</string>
</dict>
</array>
<key>NSUserTrackingUsageDescription</key>
<string>该标识符将用于向您投放个性化广告(申请时的提示,可以自己修改)</string>
4、Objective-C 代码示例
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
- (void)requestAd {
if (@available(iOS 14, *)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
// Tracking authorization completed. Start loading ads here.
// [self loadAd];
}];
} else {
// Fallback on earlier versions
// [self loadAd];
}
}
5、在项目的TARGETS的General中添加集成:
6、至此,完成。
参考:
https://www.pangle.cn/help/doc/5fbdb5571ee5c2001d3f0c6f
https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/ios14#objective-c