79544571

Date: 2025-03-30 12:12:35
Score: 0.5
Natty:
Report link

Thanks to Sweeper for the solution. To fix, I updated the code like this:

func requestIDFA() {
    Task { @MainActor in
        let status = await ATTrackingManager.requestTrackingAuthorization()
        handleATTStatus(status)
    }
}

func handleATTStatus(_ status: ATTrackingManager.AuthorizationStatus) {
    switch status {
    case .authorized:
        print("ATT: User authorized tracking")
    case .denied:
        print("ATT: User denied tracking")
    case .restricted:
        print("ATT: Tracking is restricted")
    case .notDetermined:
        print("ATT: User has not made a choice")
    @unknown default:
        print("ATT: Unknown status")
    }
}

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: vinhDev3006