Post

Replies

Boosts

Views

Activity

Reply to ATT bug, don't wait for user
I have tested this out on a number of different iOS versions and I can confirm @donnywdavis's observation that this is resolved in the iOS 17.5 beta. Here are the results of my testing: -------------------------------------- | iOS | Works? | Bug? | Test | -------------------------------------- | 16.4.0 | Yes | No | Simulator | | 17.0.0 | Yes | No | Simulator | | 17.2.0 | Yes | No | Simulator | | 17.3.1 | Yes | No | Device | | 17.4.0 | Yes | Yes | Simulator | | 17.4.1 | Yes | Yes | Simulator | | 17.5.0b | Yes | No | Device | -------------------------------------- Even though Apple is providing a fix, this bug will always be out there and will be relevant for quite a while. So, I have adapted the solution from @davidebalistreri into a drop in replacement for ATTrackingManager.requestTrackingAuthorization(). final class BugFixingATTrackingRequestManager { class func requestTrackingAuthorization() async -> ATTrackingManager.AuthorizationStatus { let status = await ATTrackingManager.requestTrackingAuthorization() if status == .denied, ATTrackingManager.trackingAuthorizationStatus == .notDetermined { debugPrint("iOS 17.4 ATT bug detected") for await _ in await NotificationCenter.default.notifications(named: UIApplication.didBecomeActiveNotification) { return await requestTrackingAuthorization() } } return status } } This solution improves on the above by being more compact, supporting async/await, and returning the AuthorizationStatus which allows it to be used directly as a replacement for let status = await ATTrackingManager.requestTrackingAuthorization() Hope this is helpful.
Apr ’24