首页 > 解决方案 > Swift:如何重新加载内容拦截器

问题描述

我在我的项目中使用“内容拦截器扩展”,并被告知我必须SFContentBlockerManager.reloadContentBlockerWithIdentifier()在我的主应用程序中调用以重新加载数据blockerList.json.

但我真的不知道我应该怎么称呼它。有任何想法吗?

标签: jsonswiftsafari-extensionios-extensions

解决方案


当需要(例如当用户更改某些内容时)从 blockerList.json 重新加载数据时,您调用:

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

推荐阅读