Strategy for user personalization : iOS Safari Content Blockers

Is there any valid strategy for user personalization of the block list json file?


The ActionRequestHandler (extension) can't access the user defaults of the main App or the user /Documents folder.


Of course the user can't replace files in the App bundle...

It's definitely possible, the json file that you return doesn't have to come from the app bundle, it could come e.g. from some Library folder where you have put or generated it earlier.


To share data between the main app and the extension, you need to set up an App Group that includes both of them and then use either shared app group defaults or shared app group data container.

Hello @mackuba,


Question for you as you seem really knowledgable about this - how can one debug the beginRequestWithExtensionContext method in the Content Blocker extension?


I've tried to add NSLog messages, and set breakpoints and run the container app as well as the Content Blocker, but no dice so far. The former doesn't output when debugging the container app, and when I try to run the content blocker it asks me to select a container app, and when I select the parent it runs, but in settings I'm unable to toggle the blocker off, so I can't see if any code runs correctly there. Advice?


thanks!

I have tried all kinds of approaches - app group, documents folder - and no luck. I cannot read the json file except from the local bundle.


I've also tried to debug the ActionReuestHandler and that doesn't work either. I tried writing a file out from the request handler and nothing. So it seems like:


a: the handler can't read files other than the one(s) provided in the bundle (this is useless for any kind of dynamic json)

b: the handler has no debugging support at all. so, anything that goes in, can never be seen.


😠

Strategy for user personalization : iOS Safari Content Blockers
 
 
Q