I have a working NEPacketTunnelProvider app extension macOS app on the App Store. The company wants to explore the possibility of switching to system extension, so that we can distribute the app outside of the appstore too.
I managed to do the switch and the extension works. But the communication is broken. DistributedNotificationCenter stopped working for me after switching to system extension, events are not received and I don't see any errors so I cannot say what's wrong.
I tried to adopt XPC from this Filtering Network Traffic Apple's sample, but I get sandbox error - domain code 4099, failed at lookup with error 159 - Sandbox restriction.
I get the same error if I try to run the sample with my company team id. I do these changes:
- NEMachServiceName to $(TeamIdentifierPrefix)com.mycompanyname.macos.dev
- App Groups to $(TeamIdentifierPrefix)com.mycompanyname.macos.dev
- Bundle ids to com.mycompanyname.macos.dev and com.mycompanyname.macos.dev.tunnelprovider
com.mycompanyname.macos.dev has capabilities - App Groups, Network Extensions, System Extensions com.mycompanyname.macos.dev.tunnelprovider - Network Extensions, System Extensions
Could you help me find the reason why DistributedNotificationCenter could stop receiving notifications?
Or are you able to run Apple's sample? What changes do you make to run it under your team? Because it looks like my changes are wrong
Either DistributedNotificationCenter or XPC would solve my problem
After enabling App Groups for the extension identifier, and disabling sandbox, XPC started to work
Cool.
Do you have a guess on where the problem is for the sandbox?
My best guess is this:
NEMachServiceName to $(TeamIdentifierPrefix)com.mycompanyname.macos.dev
App Groups to $(TeamIdentifierPrefix)com.mycompanyname.macos.dev
The service name should be an immediate ‘child’ of the App Group. For example, if your app group is TTT.com.app.group
then your service name should be TTT.com.app.group.name
.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"