I am trying to get a Notification if Guided access is enabled or disabled on the VisionPro.
For doing so you would normally just call:
NotificationCenter.default.addObserver(forName: UIAccessibility.guidedAccessStatusDidChangeNotification, object: nil, queue: .main){ noti in
print("guided access did change")
}
and this works fine on iOS devices.
But running the exact same code in Vision os Results in not getting a notification at all, even though Guided Access gets enabled or Disabled.
For testing i ran a simple default app, that works perfectly on both os types.
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.onAppear{
print("is appeairng")
NotificationCenter.default.addObserver(forName: UIAccessibility.guidedAccessStatusDidChangeNotification, object: nil, queue: .main){_ in
print("guided access did change")
}
}
.padding()
}
}
But as said it prints "guided access did change on iOS" but not on the Vision Pro.