Swift: How to Reload Content Blocker

Viewed 144

I'm using the "Content Blocker Extension" in my project, and have been informed that I have to call SFContentBlockerManager.reloadContentBlockerWithIdentifier() in my main app to reload the data in blockerList.json.

But I don't really know HOW I should call it. Any ideas?

1 Answers

When there is need (like when the user changes something) to reload the data from blockerList.json you call:

SFContentBlockerManager.reloadContentBlocker(withIdentifier: "your-blocker-id", completionHandler: { error in
    if let error = error {
        // do something here when an error is thrown
        print(error.localizedDescription)
    }
})
Related