Unable to Start NEFilter on iOS

I get the following error while trying to load save the configuration for NEFilter :

Failed to save configuration Error Domain=NEFilterErrorDomain Code=3 "(null)"

This is how I am trying to create the configuration :

Code Block let config = NEFilterProviderConfiguration()
config.username = "Test User"
config.organization = "Test Organization"
config.filterBrowsers = true
config.filterSockets = true
config.serverAddress = "localhost"
NEFilterManager.shared().providerConfiguration = config
NEFilterManager.shared().isEnabled = true
NEFilterManager.shared().saveToPreferences { (error) in
if let saveError = error{
print("Failed to save configuration \(saveError)")
return
}
}


I checked the following things :
  1. The Team ID is consistent across the App, Control Extension and Data Extension.

  2. The App ID prefix matches the Team ID.

  3. The Bundle ID for Control Extension and Data Extension are children id of the App's Bundle ID.

  4. The deployment target is set to 11.0 for the App, and the extensions.

  5. The App and the extensions do have the content-filter-provider and get-task-allow entitlement. Moreover the device is supervised.

The NSExtensionPrincipal Class is the ModuleName.CustomClassName

I also tried to manually create an unsigned profile consisting of the Content Filter Payload, which has the plugin Bundle Id which is the same as the App's Bundle ID.

How can I further debug this issue?

My understanding is that for development purposes having the get-task-allow entitlement should be enough to test the filter, and the device may not be supervised unless I am testing this on a Distribution build and in that case it would require an MDM profile. Is that correct?





Answered by Systems Engineer in 668250022
Regarding:

Failed to save configuration Error Domain=NEFilterErrorDomain Code=3 "(null)"
This is how I am trying to create the configuration :

Right, as the error indicates, somehow the NEFilterProviderConfiguration is not being set and loaded correctly. This could be due to you allowing it on the device, or just by it not being set correctly in NEFilterManager.shared().providerConfiguration = config. I would concentrate on this for debugging purposes.

Regarding:

My understanding is that for development purposes having the get-task-allow entitlement
should be enough to test the filter, and the device may not be supervised unless I am
testing this on a Distribution build and in that case it would require an MDM profile.
Is that correct?

Yes, for development purposes you can test like this.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Accepted Answer
Regarding:

Failed to save configuration Error Domain=NEFilterErrorDomain Code=3 "(null)"
This is how I am trying to create the configuration :

Right, as the error indicates, somehow the NEFilterProviderConfiguration is not being set and loaded correctly. This could be due to you allowing it on the device, or just by it not being set correctly in NEFilterManager.shared().providerConfiguration = config. I would concentrate on this for debugging purposes.

Regarding:

My understanding is that for development purposes having the get-task-allow entitlement
should be enough to test the filter, and the device may not be supervised unless I am
testing this on a Distribution build and in that case it would require an MDM profile.
Is that correct?

Yes, for development purposes you can test like this.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Unable to Start NEFilter on iOS
 
 
Q