我正在尝试获取JSON数据,然后使用URLSession将其分配给数组。但我收到一个错误,称为 BSMachError:port 9a03; (os / kern)无效功能(0x14)"无法在调试区域中插入COPY_SEND" 。我已经浏览了互联网以解决此错误,但还没有得到任何解决方案。我还检查了有关堆栈溢出的类似相关问题但尚未解决我的问题。其中一个着名的问题是 - Error '_BSMachError: port 1607; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND" in Cordova app on iOS 10 不确定问题是什么?请帮帮我的朋友。提前谢谢。
功能
func assignData(){
assignArray = []
let urlRequest = URLRequest(url: URL(string: Assign_To_URL)!)
let task = URLSession.shared.dataTask(with: urlRequest) { (data, response, error) in
if error != nil{
print(error!)
return
}
print(data!)
self.assignArray = [assignTo]()
do{
let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as! [String: AnyObject]
if let datafromjson = json["Room"] as? [[String: AnyObject]] {
print(datafromjson)
for data in datafromjson{
var assign = assignTo()
if let id = data["id"] as? Int,
let first_name = data["first_name"] as? String,
let last_name = data["last_name"] as? String,
let name = data["name"] as? String
{
assign.id = id
assign.first_name = first_name
assign.last_name = last_name
assign.name = name
}
self.assignArray?.append(assign)
}
print(self.assignArray)
}
DispatchQueue.main.async {
self.assignToPicker.reloadAllComponents()
}
}catch let error {
print(error)
}
}
task.resume()
}
错误
2018-02-08 13:42:51.586102+0530 LiveApp[22529:223782] [Common] _BSMachError: port 9a03; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"