Код: Выделить всё
0 MyApplication 0x34d760 UIViewController.requestAgeRange(gates:) + 35 (UIViewControllerExtension.swift:35)
1 libswift_Concurrency.dylib 0x62d58 + 288
2 libswift_Concurrency.dylib 0x641cc + 156
3 libdispatch.dylib 0x38a48 + 592
4 libdispatch.dylib 0x10ec8 + 180
5 libdispatch.dylib 0x10e04 _dispatch_main_queue_callback_4CF + 44
6 CoreFoundation 0x6a2c8 + 16
7 CoreFoundation 0x1db3c + 1944
8 CoreFoundation 0x1ca6c + 532
9 GraphicsServices 0x1498 GSEventRunModal + 120
10 UIKitCore 0x9e7cc + 792
11 UIKitCore 0x46f40 UIApplicationMain + 336
12 BiggerCity 0x3eec28 main + 30 (AppDelegate.swift:30)
13 ??? 0x1916f2e28 (Missing)
Код: Выделить всё
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
}
...
Код: Выделить всё
func checkAge() {
Task {
if #available(iOS 26.2, *) {
let ageCheckResult = await requestAgeRange(gates: [18])
...
Подробнее здесь: https://stackoverflow.com/questions/798 ... id-address
Мобильная версия