IDFA iOS14返回拒绝,但不显示身份验证弹出窗口 [英] IDFA iOS14 returns denied without displaying auth popup

查看:938
本文介绍了IDFA iOS14返回拒绝,但不显示身份验证弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究在iOS 14上获取IDFA.我正在使用iPhone 8 Plus.

I am doing a research on getting the IDFA on iOS 14. I am using iPhone 8 Plus.

我添加了

<key>NSUserTrackingUsageDescription</key>
<string>App would like to access IDFA for tracking purpose</string>

文件中的

.

in the .plist file.

然后添加

let type = ATTrackingManager.trackingAuthorizationStatus;

返回.denied,具有

func requestPermission() {
        ATTrackingManager.requestTrackingAuthorization { status in
            switch status {
            case .authorized:
                // Tracking authorization dialog was shown
                // and we are authorized
                print("Authorized")
            
                // Now that we are authorized we can get the IDFA
            print(ASIdentifierManager.shared().advertisingIdentifier)
            case .denied:
               // Tracking authorization dialog was
               // shown and permission is denied
                 print("Denied")
            case .notDetermined:
                    // Tracking authorization dialog has not been shown
                    print("Not Determined")
            case .restricted:
                    print("Restricted")
            @unknown default:
                    print("Unknown")
            }
        }
    }

但是我得到的.denied没有任何弹出窗口.

But I'm getting .denied without any popup.

你知道发生了什么吗?

推荐答案

有一个选项"允许应用程序请求跟踪".在系统的设置"应用中,如果关闭,requestTrackingAuthorization将立即返回.denied.

There's an option "Allow Apps to Request to Track" in system's Settings app, and if it's off, requestTrackingAuthorization will return .denied immediately.

这篇关于IDFA iOS14返回拒绝,但不显示身份验证弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆