Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
133 views
in Technique[技术] by (71.8m points)

ios - ATTrackingManager Returns .denied on first install with "Allow Apps to Request to Track" on

On some devices trackingAuthorizationStatus always comes back .denied, even though the "Allow Apps to Request to Track" switch is on. This means that the app can never request permission to track. In Settings > Privacy > Tracking the app does not have a switch to turn permission back on. Our team has several test devices, and two iPhones of the same model with the same version of iOS produce different results. One is able to display the requestTrackingAuthorization prompt and behaves as expected, while two others remain in the ATTrackingManagerAuthorizationStatusDenied state no matter what. We've tried General > Reset > Reset Location & Privacy as well as deleting the app, reinstalling, restarting, upgrading OS. Nothing fixes the .denied state. Here's the code:

    override func viewDidLoad() {
    super.viewDidLoad()
    let status = ATTrackingManager.trackingAuthorizationStatus
    switch status {
    case .authorized:
        idfaLabel.text = "Yay"
    case .denied:
        idfaLabel.text = "Goodbye IDFA"
    case .notDetermined:
        idfaLabel.text = "You've got a choice to make"
    case .restricted:
        idfaLabel.text = "can't help you there"
    default:
        print("New case???")
    }
    ATTrackingManager.requestTrackingAuthorization(completionHandler: {_ in
        print("Tracking Requested")
    })
}

Thanks in advance for any clues.

question from:https://stackoverflow.com/questions/66053531/attrackingmanager-returns-denied-on-first-install-with-allow-apps-to-request-t

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...