Hey,
I tested with iOS 18.1 (22B82) and it works again.
Thank you!
Post
Replies
Boosts
Views
Activity
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)")
}
}
}
}
}
}
Hi,
I think here is also a discussion about that topic. Maybe someone has additional information?
Apple Developer Forum Thread 759280
Thank you!
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!
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!