App Store审核隐私追踪被拒ATTrackingManag
2022-08-08 本文已影响0人
奶牛的奶糖
image.png
961660034280_.pic.jpg
解决方式:
info.plist 文件添加权限请求
NSUserTrackingUsageDescription xxx需要使用你的广告追踪权为您提供更精准的服务
AppDelegate
func applicationDidBecomeActive(_ application: UIApplication) {
if #available(iOS 14.0, *) {
ATTrackingManager.requestTrackingAuthorization { (status: ATTrackingManager.AuthorizationStatus) in
// ...
}
}
}
SceneDelegate:
func sceneDidBecomeActive(_ scene: UIScene) {
if #available(iOS 14, *){
DispatchQueue.global().asyncAfter(deadline: .now() + 1) {
ATTrackingManager.requestTrackingAuthorization { (status: ATTrackingManager.AuthorizationStatus) in
switch status {
case .notDetermined:
NSLog("--申请tracking权限,用户为做选择或未弹窗")
break
case .authorized:
NSLog("--用户允许广告追踪")
break
case .denied:
NSLog("--用户拒绝广告id")
break
case .restricted:
NSLog("--restricted")
break
@unknown default:
NSLog("--unknown")
}
}
}
}else{
if ASIdentifierManager.shared().isAdvertisingTrackingEnabled == true {
let idfa = ASIdentifierManager.shared().advertisingIdentifier
NSLog("允许广告追踪 idfa:\(idfa)")
}else{
NSLog("用户限制了广告追踪")
}
}
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
即使在applicationDidBecomeActive里面调用ATTrackingManager还是无法弹窗?
看看设置-隐私-跟踪,是否是打开的,自己关闭了,所以无论怎么都不会有弹窗
961660034280_.pic.jpg
参考链接:
https://www.shouxicto.com/article/750.html
http://events.jianshu.io/p/3b68ff32b886