Hi, I'm the author of SelfControl, a Mac app that helps users block their own access to distracting websites. I am trying to bring this same app to iOS.
I created an app, based on the SimpleTunnel sample code, which uses filter control provider and filter data provider extensions to implement our filter. When we start filtering, the code looks like this:
NEFilterProviderConfiguration *newConfiguration = [NEFilterProviderConfiguration new];
newConfiguration.username = @"CharlieStigler";
newConfiguration.organization = @"SelfControl";
newConfiguration.filterBrowsers = YES;
newConfiguration.filterSockets = YES;
[[NEFilterManager sharedManager] setProviderConfiguration:newConfiguration];
[[NEFilterManager sharedManager] setEnabled:YES];
This was working great on my development versions of the app, running them from Xcode. However, when I made a version for Ad Hoc distribution and tried to distribute it onto my device, this step (setting the provider configuration) failed with a "permission denied" error. The logs show:
Sep 24 22:30:08 iPhone nehelper(NetworkExtension)[89] <Error>: -[NEHelperConfigurationManager:553 SelfControlIOS trying to create a content filter configuration through an app. Creating a content filter configuration is only allowed through profile in production version of SelfControlIOS.
Sep 24 22:30:08 iPhone SelfControlIOS(NetworkExtension)[23814] <Error>: -[NEFilterManager saveToPrefer:212 -[NEFilterManager saveToPreferencesWithCompletionHandler:]_block_invoke: failed to save the new configuration: Error Domain=NEConfigurationErrorDomain Code=10 "permission denied" UserInfo={NSLocalizedDescription=permission denied}
Sep 24 22:30:08 iPhone SelfControlIOS[23814] <Notice>: Failed to save the filter configuration: Error Domain=NEConfigurationErrorDomain Code=10 "permission denied" UserInfo={NSLocalizedDescription=permission denied}
What do I need to do to get my network extension working for Ad Hoc distribution, and keep testing my app before it's submitted to the App Store?
(The app is open-source, so full source code is available here: https://github.com/SelfControlApp/selfcontrol-ios)