I have an app which contains a Network Extension and when I run it from within XCode, it uses the profiles I have created with the proper entitlements and works fine without issue.
However, when I archive the project and select the same team, the network extension fails to start when I install and run that IPA file:
Dec 31 19:00:00 My-iPad Worx Home(NetworkExtension)[38454] <Error>: Failed to save configuration: Error Domain=NEVPNErrorDomain Code=5 "permission denied" UserInfo={NSLocalizedDescription=permission denied}
I'm pretty sure this is because something is getting messed up with the entitlements.
I went back through the "Export" process and the provisioning profile it shows is not the one I want to use, it is one that says "iOS Team Provio..." and I cannot change it to the profile I want to use.
I know there are other posts about this (like this), however none of the solutions there seem to work. In particular, the solution which involves a command line command only takes in a single provisioning profile which will never work, since I would need to select two different ones: one for the main app and one for the extension.
UPDATE: I checked the embedded.mobileprovision file inside of the IPA file and it actually does seem to be signed with the right profile. So it may not be a profile issue after all. But if so, why would I be getting "Permission Denied" error?
I did a full clean again and confirmed I am seeing "com.apple.developer.networking.vpn.api" (allow-vpn) for both the main app and extension in the list that shows up right before the IPA file is generated.
Right before I get the "Permission denied" error, I see the following cryptic error:
[My App Name] is not allowed to save provider-based configurations
UPDATE 2: I created two enterprise distribution profiles (I had used development ones before) and when I do ad-hoc now the extension works.
I am unblocked for the moment, but would like to determine why this wasn't working originally as it will be valuable information, so leaving this question open.