Post

Replies

Boosts

Views

Activity

Reply to Request authorization for the notification center crash iOS app on Swift 6
Hi in the meantime I solved it like this. Maybe this is helpful for someone. func getUserNotificationPermission(completion: @Sendable @escaping (String) -> Void) { DispatchQueue.global(qos: .userInteractive).async { UNUserNotificationCenter.current().getNotificationSettings { settings in if settings.authorizationStatus == .authorized { completion("authorized") } if settings.authorizationStatus == .provisional { completion("authorized") } if settings.authorizationStatus == .ephemeral { completion("authorized") } if settings.authorizationStatus == .denied { completion("denied") } if settings.authorizationStatus == .notDetermined { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in if success { completion("authorized") } else { completion("denied") } } } } } } I can call this function via a Button from a SwiftUI View: struct ContentView: View { var body: some View { VStack { Button("getUserNotificationPermission") { getUserNotificationPermission { permission in if permission == "authorized" { print("permission: \(permission)") } } } } } }
Oct ’24
Reply to Request authorization for the notification center crash iOS app on Swift 6
Hi, I tried to apply the solution of Quinn to UNUserNotificationCenter.getNotificationSettings(completionHandler:) and get the error "Non-sendable type 'UNNotificationSettings' returned by implicitly asynchronous call to nonisolated function cannot cross actor boundary" It would be great if someone could help me to fix it. func getNotificationSettings() { let center = UNUserNotificationCenter.current() Task { let settings = await center.notificationSettings() // here I get the error "Non-sendable type 'UNNotificationSettings' returned by implicitly asynchronous call to nonisolated function cannot cross actor boundary" let authorizationStatus = settings.authorizationStatus } } Thank you!
Oct ’24
Reply to CoreBluetooth Advertising and Scanning Issue in iOS 18/iPadOS 18 Beta 3
Hi, I just tested with iOS 18.0.1 with the same issue. As soon as the peripheral device enters into background, the central device does not receive callbacks to CBCentralManagerDelegate.centralManager(_:didDiscover:advertisementData:rssi:) when scanning with scanForPeripherals(withServices:options:) This worked before changing to iOS 18 and SWIFT 6. Does anyone have some news about this topic or some feedback from Apple? Thank you!
Oct ’24