I already created a small test app with nothing then a button to run MatterSupport in it's extension. I used the test app as host for the extension then, same like I did it for Siri or AppWidgets (should be the same flow for the Matterextension, or am I wrong).
Yes, the flow here can be very different. Pulling a quote from here:
"Using Xcode to debug an app extension is a lot like using Xcode to debug any other process, but with one important difference: In your extension scheme’s Run phase, you specify a host app as the executable. Upon accessing the extension through that specified host’s UI, the Xcode debugger attaches to the extension."
In the case above, the app is requesting an app extension to be launched and the system is maintaining a connection between the specific hosting app and the extension. The issue here is that not all of our extension (including the matter extension here) are actually hosted like this.
Some extensions, particularly our "lower level" extensions (network extensions, notification services extensions) are actually designed to be hosted by a specific system process, so that process is the only process that ever hosts them. That's what's going on here. What MatterAddDeviceRequest actually does is tell the system "please present the Matter Paring UI". The system then launches the component that creates the UI you're interacting with and THAT component is what then launches and hosts your MatterSupport extension. It's possible you might be able to get the flow above working by adding that system process as the host app (I'm honestly not sure), but what will work is to have the system present the UI (launching your MatterSupport Extension), then manually attaching using "Debug -> Attach to Process".
Note that with this flow:
What I expected, is, that at least the init function will be triggered in the debugger, but even this isn't working. So I guess, I missed something adding the extension correctly.
...you'll always "miss" your init function, as will have finished running before you're able to attach. However, in practice that shouldn't matter as the actual delegate methods are what you're actually trying to debug.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware