Not getting call in startFilter method of NEFilterProvider

I have created a Network Extension subclassing NEFilterDataProvider. From the App I have added provider configuration using NEFilterManager. But, once I start the app and extension, I am not getting any callbacks in extension.


None of below methods are being called:

  • startFilter
  • stopFilter
  • handleNewFlow


Please suggest how to start filtering the content.


here is the code from host app.


[[NEFilterManager sharedManager] loadFromPreferencesWithCompletionHandler:^(NSError * _Nullable error) {
        if(![NEFilterManager sharedManager].providerConfiguration){
            NEFilterProviderConfiguration *aFilterConfig = [[NEFilterProviderConfiguration alloc]init];
            aFilterConfig.username = @"USER";
            aFilterConfig.filterBrowsers = YES;
            aFilterConfig.serverAddress = @"Content Filter";
            [[NEFilterManager sharedManager]setProviderConfiguration:aFilterConfig];
            [[NEFilterManager sharedManager] setEnabled:YES];
            [[NEFilterManager sharedManager] saveToPreferencesWithCompletionHandler:^(NSError * _Nullable error) {
                if(error){
                    NSLog(@"%@",error);
                }
            }];
     }
}];

Replies

Are you already creating a filter control provider (that is, a provider whose principal class is subclass of

NEFilterControlProvider
)? Filter providers always come in pairs.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I have created two Extensions

1) Subclass of NEFilterDataProvider

2) Subclass of NEFilterControlProvider

Cool. Now do the following:

  1. In your

    NEFilter{Control,Data}Provider
    subclasses, override
    init
    .
  2. Have that override log something unique and then call through to

    super
    .
    init() {
        NSLog("QQQ in {control,data} provider init")
        super.init()
    }

    .

  3. Re-run your test.

  4. See which, if any, of your log messages show up.

This test will tell you whether you’re provider is being loaded at all. If the provider is being loaded, then you can investigate problems in the provider code itself. If the provider is not being loaded, you’ll need to look at how it’s packaged.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

im facing the same problem. the init method was called but startFilter not.

I'm experiencing the same problem. The Filtering Network Traffic demo does not call StartFilter.


Furthermore, adding logging in the DataProviders init as you suggested does not show in the console, even though I can see that the extension was found by NEsessionmanager.