Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catalyst 'SwiftUI.AccessibilityNode' is not a known serializable element

I created a fresh iOS Single Page App (including SwiftUI) with Xcode 11.1 and enabled Mac Catalyst. After running the fresh Project on my Mac (macOS 10.15 of course) I get the following errors after tapping once on the window.

2019-10-18 12:59:48.479186+0200 test[3130:122148] Metal API Validation Enabled
2019-10-18 12:59:50.960734+0200 test[3130:122148] [AXRuntimeCommon] Unknown client: test
2019-10-18 12:59:50.962261+0200 test[3130:122148] [AXRuntimeCommon] This class 'SwiftUI.AccessibilityNode' is not a known serializable element and returning it as an accessibility element may lead to crashes
2019-10-18 12:59:51.313 test[3130:122148] **************_____________**************AXError: AVPlayerView is not a kind of NSView
1   AccessibilityBundles                0x00007fff42ee3b69 _AXBValidationCheckIsKindOfClass + 201
2019-10-18 12:59:51.386 test[3130:122148] **************_____________**************AXError: MKStarRatingView is not a kind of NSView
1   AccessibilityBundles                0x00007fff42ee3b69 _AXBValidationCheckIsKindOfClass + 201

Note: I also removed the Sandbox capability otherwise I get error about can't writing ApplicationAccessibilityEnabled

Does anyone know how to solve that?

like image 986
Lukas Kirner Avatar asked Oct 18 '19 11:10

Lukas Kirner


2 Answers

As far as I can tell, there isn't a way to get rid of that error, and there isn't a need to; it's something inherent in SwiftUI. It occurs on iOS, iPadOS, and (therefore) Mac Catalyst, even in a brand new project. It also doesn't seem to hurt anything, other than to worry us developers.

I've been working in SwiftUI for the past six months full-time on an app that is now in production running on iOS, iPadOS and MacOS (Catalyst). The This class 'SwiftUI.AccessibilityNode' is not a known serializable element error has been there since the beginning. I haven't traced it to be the source of any problem in six months of SwiftUI development.

If you open Xcode, create a new single-view iOS project, and run it without change, it'll display "Hello, World!". Click "Hello, World!" and your console will log [AXRuntimeCommon] This class 'SwiftUI.AccessibilityNode' is not a known serializable element and returning it as an accessibility element may lead to crashes.

I've tried adding accessibility modifiers, e.g.:

struct ContentView: View {
    var body: some View {
        Text("Hello, World!")
        .accessibility(hint: Text("Just say hi"))
        .accessibility(identifier: "helloWorld")
    }
}

The error still gets logged when I click "Hello, World!".

I've also tried extending SwiftUI.AccessibilityNode to make it a serializable element, e.g.:

import SwiftUI

extension SwiftUI.AccessibilityNode {
}

Xcode says type SwiftUI.AccessibilityNode doesn't exist.

like image 74
ggruen Avatar answered Nov 08 '22 17:11

ggruen


If you find them annoying as I do you can silence them as mentioned in this answer:

Hide strange unwanted Xcode logs

like image 30
djdrzzy Avatar answered Nov 08 '22 17:11

djdrzzy