Problem with DriverKitUserClientSample

First time working with DEXT, so I'm trying to make "Communicating between a DriverKit extension and a client app" sample project to work and I'm having trouble.

I'm following the steps for "Automatically manage signing". It seems that the step “Sign to Run Locally” is wrong now, so I let it to Apple Developer.

Now I have a Provisioning Profile error that says it doesn't include the com.apple.developer.driverkit.allow-any-userclient-access entitlement.

If I go to Certificates, Identifiers and Profiles for this AppID and go to Capability Requests and select DriverKit Allow Any UserClient Access, this bring me to a page where I select DriverKit Entitlement but Any UserClient Access is not a choice. I tried asking for UserClient Access but the request has been denied saying that the engineering team does not think these entitlements are necessary for testing locally. So I removed com.apple.developer.driverkit.allow-any-userclient-access from NullDriver.entitlements. I can now install the DEXT but when I try "Communicate with Dext" button, I received the error: Failed opening connection to dext with error: 0xe00002e2.

Looking in the console, I see this error message: DK: NullDriverUserClient-0x10000ad6a:UC failed userclient-access check, needed bundle ID com.example.apple-samplecode.dext-to-user-client-2-TEST.driver

I tried many things, but I can't seem to be able to pass through the check to allow the application to communicate with the dext. What am I missing?

Note that I'm focusing only on macOS, not iOS.

Thanks.

Answered by DTS Engineer in 865868022

Can you file a bug on this and post the bug number back here? I think the right solution here is to add a dev-only variant of "com.apple.developer.driverkit.allow-any-userclient-access", but it would be helpful if I had a developer bug on this issue.

Actually, don't bother with that. Thanks to some excellent help from the team responsible who manages the developer portal the new entitlement:

DriverKit Allow Any UserClient (development)

...is now live. Add that to your DEXT, at it will accept connections from "any" app but, of course, only in development.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

I tried many things, but I can't seem to be able to pass through the check to allow the application to communicate with the dext. What am I missing?

So, as it happens, I have a post here that's specifically about getting this sample to work.

Try what that post suggests and let me know if you're still having issues.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

That sample doesn't quite work out of the box. Here is how you can get it to work on macOS 26 with Xcode 26 (and earlier versions of both, but that's what I'm using).

Download the sample from https://developer.apple.com/documentation/driverkit/communicating-between-a-driverkit-extension-and-a-client-app?.

Follow only some of the directions under Configure the sample code project:

  1. (turn off SIP) - skip this, it is no longer necessary

  2. Set Automatically manage signing for both the driver and the app targets

Select a development team. Xcode will tell you that you cannot select an individual for this type of signing.

  1. ignore the advice about "Sign to run locally" and AD_HOC_CODE_SIGNING_ALLOWED.
  2. ignore all the other stuff. You don't need to make profiles, add capabilities, manually download profiles or add them to Xcode.

Now go the Build Settings for the driver and app target, and change the Product Bundle Identifier. The download project uses a disambiguation string that doesn't work, and you end up with very long bundle IDs which cause an error - see https://developer.apple.com/forums/thread/785223

I used

com.shorty.dext-to-user-client-2-${DEVELOPMENT_TEAM}.driver

for the driver and

com.shorty.dext-to-user-client-2-${DEVELOPMENT_TEAM}

for the app

Then, to make running and debugging easier, you can alter the Scheme for the app. In Xcode, at the top of the window, click on your app target and select Edit Scheme. In the dialog, expose the Build scheme and select the Post Actions. Add a new Run Script phase with this content:

ditto "${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}" "/Applications/${FULL_PRODUCT_NAME}"

That will put your app into /Applications every time you build it. Build the app.

Next, tell the debugger to run that copy and not the one in the Build Products folder. Expose the Run part of the scheme, click on the Run section, then in the Info tab you'll see a popup for the Executable: location. Click that, select other..., navigate to your app in /Applications.

Everything else should Just Work.

It is possible to develop dexts if you're not a member of a development team, but it is much more difficult.

Yes I already saw and followed the post and I'm still having issues. My problem is not the build, it's the connection at runtime. Here is the console log when I'm clicking on "Communicate with Dext" button:

default 10:00:51.839911-0500 kernel NullDriver Base - NewUserClient() default 10:00:51.839963-0500 kernel NullDriver UserClient - init() default 10:00:51.840010-0500 kernel NullDriver UserClient - init() - Finished. default 10:00:51.840014-0500 kernel NullDriver Base - NewUserClient() - Finished. default 10:00:51.840110-0500 kernel NullDriver UserClient - Start() - Finished. default 10:00:51.840138-0500 kernel DK: NullDriverUserClient-0x100007a7d:UC failed userclient-access check, needed bundle ID com.example.apple-samplecode.dext-to-user-client-2-TEST.driver default 10:00:51.840459-0500 kernel NullDriver UserClient - Stop() default 10:00:51.840481-0500 kernel NullDriver UserClient - Stop() - Cancels started, they will stop the dext later. default 10:00:51.840512-0500 kernel NullDriver UserClient - Stop() - Finished. default 10:00:51.840519-0500 kernel NullDriver UserClient - free()

I tried adding com.apple.security.temporary-exception.iokit-user-client-class to DriverKitSampleApp.entitlements, SIP is disabled, developer mode is on, but nothing helped.

Thanks

Thanks ssmith_c, I tried your suggestions to run from /Applications and did not change the behavior, I'm still not able to communicate with the Dext.

I had already changed the Product Bundle Identifier, I'm my case, when I select my Team the ${SAMPLE_CODE_DISAMBIGUATOR} got replaced by -SAMPLE_CODE_DISAMBIGUATOR- in the Bundle Identifier name. If I change it back to ${SAMPLE_CODE_DISAMBIGUATOR}, it changes back automatically to -SAMPLE_CODE_DISAMBIGUATOR-, so the output file really contains 'SAMPLE_CODE_DISAMBIGUATOR' in it, not what it is supposed to refer to. I also tried with ${DEVELOPMENT_TEAM} and it does the same thing. I ended up by simply adding TEST at the end...

Regards

I tried adding com.apple.security.temporary-exception.iokit-user-client-class to DriverKitSampleApp.entitlements. SIP is disabled, developer mode is on, but nothing helped.

Sigh... so, I took another look at our code and, unfortunately, none of this will work. This all works for IOKit user clients, but there is a second level DEXT check I’d overlooked, which is what you're actually failing.

Can you file a bug on this and post the bug number back here? I think the right solution here is to add a dev-only variant of "com.apple.developer.driverkit.allow-any-userclient-access", but it would be helpful if I had a developer bug on this issue.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Can you file a bug on this and post the bug number back here? I think the right solution here is to add a dev-only variant of "com.apple.developer.driverkit.allow-any-userclient-access", but it would be helpful if I had a developer bug on this issue.

Actually, don't bother with that. Thanks to some excellent help from the team responsible who manages the developer portal the new entitlement:

DriverKit Allow Any UserClient (development)

...is now live. Add that to your DEXT, at it will accept connections from "any" app but, of course, only in development.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Yay, it's working now.

I was still getting the Failed opening connection to dext with error: 0xe00002e2 error in Xcode console when clicking on "Communicate With Dext" button but it was because the iterator in DeviceAdded found two devices, the first one connected without error and the second one returned the connection error.

It took me a little while to figure out that I made two Dext based on the same example code and they conflicted with one another, so I deleted them both from the Driver Extensions window and now was getting the error The operation couldn't be completed (OSSystemExtensionErrorDomain error 4.) when trying to reinstall it.

I needed to reboot for the uninstallation to complete and now everything is fine.

Thanks.

Problem with DriverKitUserClientSample
 
 
Q