This sound popping issues started happening with Xcode 12 and it has been months with no fix. Problem is that simulators (SwiftUi views are using them also) and the fact that phones do not have the same "sound" hardware a.k.k simulators actually change the output of the sound you hear in on your Mac (because they "simulate" it to show what the phone would do). Unfortunately this causes many many issues on the Mac sound hardware but is 100% fixable by the Xcode team, we cant do anything ourselves its a problem if the simulators "highjacking" the systems sounds and outputting it via a hardware that is not supposed to output this way.
This is mind boggling that it is still not fixed.
Post
Replies
Boosts
Views
Activity
Lol really you cannot delete? Wooow man this is incredible and I just started with CloudKit to find out this basic functionality not working hahahah.
I send feedback to Apple and received answer to retest this with iOS 16.2. After retesting this is not longer shown as a warning so it looks like Apple has fixed it behind the scenes.
I have reported this issue to Firebase and they are working on a solution for next version.
https://github.com/firebase/firebase-ios-sdk/issues/13756
I will add my initial solution as a comment so it can be marked as solution to the question.
The only solution that I have found so far is to switch to using the async version of the requestAuthorization API:
Task {
let center = UNUserNotificationCenter.current()
do {
if try await center.requestAuthorization(options: [.alert, .sound, .badge]) == true {
print("success")
} else {
print("fail")
}
} catch {
print("Error")
}
}
While waiting for some official statement why this is happening in iOS 18 and not iOS 17, I found a workaround to force a refresh of the managedObjectContext when changes are saved.
Code sample:
@Environment(\.managedObjectContext) private var managedObjectContext
var body: some View {
NavigationStack {
Text("")
}
.onReceive(NotificationCenter.default.publisher(for: .NSManagedObjectContextDidSave)) { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
withAnimation {
managedObjectContext.refreshAllObjects()
}
}
}
}
It's not perfect but it gets the job done to update the list when any attributes are changed, not only those used as SortDescriptor. Hope this helps anyone facing this problem.