i am working on content blocker and block the adult site so, this code is perfect work on simulator when i test on iPhone 6 then its no one site is block
Alamofire.request(url).responseJSON { response in
if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
print("Data: \(utf8Text)")
self.containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.domainName.contentBlocker")
let path = self.containerURL?.appendingPathComponent("blockerList.json")
self.text = utf8Text.description
do {
try self.text.write(to: path!, atomically: true, encoding: String.Encoding.utf8)
}catch{
print(error)
}
print(path)
}
}
Then after load data on extension handler file. Thanks in advance.
I had a similar issue where reading the contents of the group directly worked on the simulator, but not on a device. It resolved this by creating a subdirectory in the group and do all reading writing in this subdirectory.