应用跟踪透明度不显示对话Bbox

发布于 2025-02-12 01:14:33 字数 1087 浏览 0 评论 0原文

我已经尝试了其他相关问题中的解决方案,但是答案对我不起作用。

我已经设置了应用程序跟踪透明度,但是由于某种原因,它的对话框永远不会在屏幕上显示。这是我正在使用的代码:

    func appTrackingAuthorisation() {
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
            ATTrackingManager.requestTrackingAuthorization { status in
                switch status {
                case .authorized:
                    print("Enable tracking")
                case .denied:
                    print("Deny tracking")
                case .restricted:
                    print("Restrict (denied) tracking")
                default:
                    print("Not determined")
                }
            }
        }
    }

我的viewDidload()中

    override func viewDidLoad() {
        super.viewDidLoad()
        appTrackingAuthorisation()
        checkLocationServices()
    }

在 导致ATT不出现。我已经尝试将其放入func ApplicationDidBecomeycomecomective(_ application:uiapplication)中的AppDelegate中,因为这是Apple建议的,但仍然不起作用。还设置了info.plist中的nsusertrackingusagedescription。还允许应用程序要求跟踪。

I've tried the solutions in other related questions but none of the answers work for me.

I've got App Tracking Transparency set up but for some reason, the dialogue box for it never shows on screen. This is the code I'm using:

    func appTrackingAuthorisation() {
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
            ATTrackingManager.requestTrackingAuthorization { status in
                switch status {
                case .authorized:
                    print("Enable tracking")
                case .denied:
                    print("Deny tracking")
                case .restricted:
                    print("Restrict (denied) tracking")
                default:
                    print("Not determined")
                }
            }
        }
    }

In my viewDidLoad() is where I'm calling the function:

    override func viewDidLoad() {
        super.viewDidLoad()
        appTrackingAuthorisation()
        checkLocationServices()
    }

I also have a location permission dialogue box show and I'm not sure if that being there is causing the ATT to not show up. I've tried putting it in AppDelegate in func applicationDidBecomeActive(_ application: UIApplication) as that's what Apple recommends but it still doesn't work. NSUserTrackingUsageDescription in Info.plist is also set. Allow apps to ask for tracking is also enabled.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文