- read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
- start by adding a new extension target to your iOS app of type “content blocker”
- launch the app using the main target’s scheme + a call to
SFContentBlockerManager.reloadContentBlockerWithIdentifier()
with the extension’s id inapplication:didFinishLaunchingWithOptions:
to auto-reload the blocker in development mode - if you don’t call
reloadContentBlockerWithIdentifier()
then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving) - use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
- things like periods in the
url-filter
regexp need to be escaped with double backslashes, e.g.facebook\\.net
- if you use
if-domain
, it needs to be an array, even for one element - domain
foo.com
might not matchwww.foo.com
even though I think it’s supposed to (UPDATE: They've changed it in one of