There’s two parts to this:
-
Getting CMake to create an appex
-
Configuring that appex to be an NE provider
I don’t maintain expertise in CMake so I can’t help you with the first. I recommend that you ask this via the support channel for that third-party tool.
Once you know how to create any type of appex, the NE specifics are:
-
Subclass the relevant NE provider class. For example, if you’re building a packet tunnel provider, subclass NEPacketTunnelProvider
.
-
Populate the NSExtension
value within the Info.plist
like so:
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>PPP</string>
<key>NSExtensionPrincipalClass</key>
<string>CCC</string>
</dict>
where:
-
PPP
is the extension point. For example, a packet tunnel provider would have com.apple.networkextension.packet-tunnel
.
-
CCC
is the name of your class from step 1. If that class is written in Swift, make sure to prefix it with the module name.
-
Add an embedded provisioning profile with the Network Extension capability.
-
Sign your appex with the Network Extension entitlement (com.apple.developer.networking.networkextension
). Again, the specific value varies by provider type. As an example, in a packet tunnel provider the value is an array containing packet-tunnel-provider
.
-
Repeat steps 3 and 4 for the container app.
If you get stuck, a good technique is to create a test project using Xcode and then crib values from there.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"