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 thebeginRequestWithExtensionContext
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.