Hi everyone and thanks for your time.
Intro
I'm developing an iOS app that has Content Blockers as one of its features. For this, we have a list of predefined rules the user can enable/disable at will, and also an option to enter custom rules.
Whenever there's a change (enable, disable, add or remove), I get all the rules and recreate the JSON files, one file for every 150K rules (we have more than one content blocker). Most users just need one JSON file though. And then call the content blockers reload.
The Problem
Most of the time, it works well. The content blocker reloads and I can verify in Safari that it's working.
But, sometimes within the completionHandler of:
SFContentBlockerManager.reloadContentBlocker(withIdentifier:completionHandler:)
It returns the following error:
Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.SafariServices.ContentBlockerLoader" UserInfo={NSDebugDescription=connection to service named com.apple.SafariServices.ContentBlockerLoader}
Localized description: Couldn’t communicate with a helper application.
Can't find a reason why this is happening. Some previous research said this could be related to:
App groups, but I verified them and they are correctly set (even because the blockers reload works most of the time);
Content blocker process being killed. But why would it be killed just sometimes? And how to I verify if this is the case?
I'm seeing a number of these errors (added a log) in production.
Thanks for the help.
Post
Replies
Boosts
Views
Activity
Hi,
We have an iOS app with Safari and Content Blocker extensions. Everything works fine when running the app on M1 devices except for the content blocker. The issue is with the following code:
contentBlockerManager.getStateOfContentBlocker(withIdentifier: "...") { [ weak self ] in state, error
...
}
I receive an error which I believe means the content blocker was not found:
SFErrorDomain error 1
Now, when running the exact same app with Mac Catalyst all works as expected.
Is there a reason for this to happen?
Thanks.
Hi,
Before iOS 15.4, getStateOfContentBlocker would return the correct content blocker state when moving the app to background, going to Safari settings to enable/disable it, and then back to the app.
Now, on iOS 15.4, the state returned by the method is not updated unless I kill the app and start it again.
I confirmed that the same code on iOS 15.2 works as expected.
Running on Xcode 13.3.
Has anyone else experienced this?
Thanks.