我正在研究内容拦截器并阻止成人网站所以,这个代码是完美的模拟器工作,当我在iPhone 6上测试然后它的无人网站是阻止
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)
}
}
Run Code Online (Sandbox Code Playgroud)
然后在扩展处理程序文件上加载数据后.提前致谢.
var testarray = NSArray()
testarray = [1,2,2,3,4,5,3]
print(testarray)
testarray.removeObject(2)
Run Code Online (Sandbox Code Playgroud)
我想从多个匹配对象中删除单个对象
myArray = [1,2,2,3,4,3]
Run Code Online (Sandbox Code Playgroud)
当我删除
myArray.removeObject(2)
Run Code Online (Sandbox Code Playgroud)
然后删除两个对象.我想只删除单个对象.
我尝试使用许多扩展但没有人正常工作.我已经使用过此链接.
我想获得这种形式的甲骨文-> 2018年4月20日UTC + 5:30 PM 9点以获取firestore时间戳。我已经尝试过此代码,但是没有得到如上所述的正确格式。
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "MMMM d yyyy hh:mm:ss a Z"
formatter.timeZone = NSTimeZone(name: "IST") as TimeZone?
let result = formatter.string(from: date)
print(result)
Run Code Online (Sandbox Code Playgroud)
已经使用此格式化程序formatter.dateFormat =“ MMMM d yyyy'T'hh:mm:ss Z
谢谢
我有一个[[String]]喜欢
myArr = [["1_2","1_3","1_4"], ["2_1","2_2","2_3"], ["3_1","3_2","3_3"]]然后
我想删除这样的元素
bypassArr = ["1_2","2_3","3_2"]
如何bypassArr从myArr使用元素中删除。或者我怎样才能得到这种类型的结果。
result = [["1_3","1_4"], ["2_1","2_2"], ["3_1","3_3"]]