Swift:如何重新加载内容拦截器

时间:2021-03-31 16:47:26

标签: json swift safari-extension ios-extensions

我在我的项目中使用了“Content Blocker Extension”,并被告知我必须在主应用程序中调用 SFContentBlockerManager.reloadContentBlockerWithIdentifier() 以重新加载 blockerList.json. 中的数据

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

1 个答案:

答案 0 :(得分:0)

当需要(例如用户更改某些内容时)从 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)
    }
})