0

I am searching for a way to easily deactivate the safari content blocking from within the app. Any idea how to do this? Can SFContentBlockerManager.reloadContentBlockerWithIdentifier be helpful for this?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
MJQZ1347
  • 2,607
  • 7
  • 27
  • 49

2 Answers2

0

If you are displaying data inside SFSafariViewController it's impossible, because Enabling/Disabling iOS9 Content Blocker is a User Settings. As far as I understand it, Content blocker doesn't affect UIWebView.

During beta reloadContentBlockerWithIdentifier worked in Simulator, but didn't work on real devices.

themoah
  • 167
  • 2
  • 13
0

You can "kinda" disable safari content blocking by providing NSItemProvider with no rules in the ContentBlockerRequestHandler.

Whenever user enables/disables content blocking in the main app you can sync this state with the extension e.g. using shared container UserDefaults(suiteName:) in the App Group and call SFContentBlockerManager.reloadContentBlockerWithIdentifier

Of course, the extension will have to stay enabled in Settings.

Laevand
  • 822
  • 9
  • 14