ARTICLE AD BOX
I have implemented the new Age Range Requirements in my application, however I'm starting to get crash reports with the command try await AgeRangeService.shared.isEligibleForAgeFeatures. I have the stack trace
0 MyApplication 0x34d760 UIViewController.requestAgeRange(gates:) + 35 (UIViewControllerExtension.swift:35) 1 libswift_Concurrency.dylib 0x62d58 <redacted> + 288 2 libswift_Concurrency.dylib 0x641cc <redacted> + 156 3 libdispatch.dylib 0x38a48 <redacted> + 592 4 libdispatch.dylib 0x10ec8 <redacted> + 180 5 libdispatch.dylib 0x10e04 _dispatch_main_queue_callback_4CF + 44 6 CoreFoundation 0x6a2c8 <redacted> + 16 7 CoreFoundation 0x1db3c <redacted> + 1944 8 CoreFoundation 0x1ca6c <redacted> + 532 9 GraphicsServices 0x1498 GSEventRunModal + 120 10 UIKitCore 0x9e7cc <redacted> + 792 11 UIKitCore 0x46f40 UIApplicationMain + 336 12 BiggerCity 0x3eec28 main + 30 (AppDelegate.swift:30) 13 ??? 0x1916f2e28 (Missing)I do know the isEligibleForAgeFeatures is pretty new, as it was introduced in iOS 26.2, so there can still be bugs in the code, but I'm curious if anyone has figured out a fix to prevent the crash from occurring? I have created an extension of UIViewController
extension UIViewController { enum AgeGateResult { case allowed // 18+ confirmed OR out-of-scope case blockedUnder18 // Confirmed minor case needsConfirmation // Eligible but declined / not yet shared case displayAgeDialog } @MainActor @available(iOS 26.2, *) func requestAgeRange( gates: [Int] ) async -> AgeGateResult { // Default to allowed (fail-open) unless we determine otherwise var validAge = true do { // Safely check eligibility — if the call throws, treat as eligible (fail-open) var isEligible: Bool = false do { isEligible = try await AgeRangeService.shared.isEligibleForAgeFeatures } catch { validAge = true return .allowed } ...I do perform the check on startup with my initial UIViewController within a Task block
func checkAge() { Task { if #available(iOS 26.2, *) { let ageCheckResult = await requestAgeRange(gates: [18]) ...Does anyone have an idea what a possible fix could be if any? Or is this something that Apple might have to fix with the Age Range class?
