I'm playing with XCode7 beta, trying to test the shiny new "Content Blocker Extension". The example class is adopting the same NSExtensionRequestHandling
protocol as the (already known) Sharing extension. The essential difference from Sharing extension is that the class is a plain NSObject
, not a *ViewController
subclass because, you know, a Blocker Extension isn't supposed to be showing any UI feedback. That's my understanding at least. Anyway the crucial method beginRequestWithExtensionContext
which is supposed to feed the blocker declaration JSON to the extension point, does not get invoked. The extension does have TRUEPREDICATE
as its NSExtensionActivationRule
and Safari does acknowledge the existence of my host app in the new Safari config "Content Blockers". But still no cigar.
Does anybody know if it's even supposed to be already working this early in the beta or was it just a press release?
And, oh, while we're at it, is there any documentation of that declarative JSON format or it's just my Google-Fu failing me? :)
How do you know the extension isn't getting invoked?
I built a very quick test app and did a simple NSLog()
from the beginRequestWithExtensionContext
method and it was getting called when the extension was switched on.
Also, fwiw, there's +[SFContentBlockerManager reloadContentBlockerWithIdentifier:completionHandler:]
which lets you trigger an update from the main app, at will.
There isn't any documentation yet, but I found that some characters in the url prevent the load of the JSON They are (the one I found, might be more): +(as prefix) , $, |, ^
Is there any documentation of that declarative JSON format
The webkit.org blog post below seems to be the current best "official" documentation of the Content Blocker JSON format.
https://www.webkit.org/blog/3476/content-blockers-first-look/
Use the device console to view a live log of the device. There you will see your NSLog() calls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With