3

I am trying to fetch JSON data and later assign it to an array using URLSession. But I am getting an error known as BSMachError: port 9a03; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND" in the debug area. I have browsed the internet for solution of this error also but did not get any solution yet. I have also check for similar related questions on stack overflow yet not solved my issue. One of the famous asked question is - Error '_BSMachError: port 1607; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND" in Cordova app on iOS 10 Not sure what's the problem? Please help me friends. Thanks in advance.

Function

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()
}

Error

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"
Saurabh
  • 745
  • 1
  • 9
  • 33
  • Possible duplicate of [Error '\_BSMachError: port 1607; (os/kern) invalid capability (0x14) "Unable to insert COPY\_SEND" in Cordova app on iOS 10](https://stackoverflow.com/questions/39676762/error-bsmacherror-port-1607-os-kern-invalid-capability-0x14-unable-to-i) – Scriptable Feb 08 '18 at 08:57
  • This issue has been raised many times on SO, see [here](https://stackoverflow.com/questions/32899586/error-message-bsmacherror-os-kern-invalid-capability-20?rq=1) or [here](https://stackoverflow.com/search?q=Unable+to+insert+COPY_SEND) – Scriptable Feb 08 '18 at 08:58
  • thanks but none of them is working for me @Scriptable – Saurabh Feb 08 '18 at 09:01
  • This is a very strange issue, if none of those answer your question it is unlikely we'll be able to help you, someone might make some suggestions, but I would try the solutions in the last link i gave and also raise a question on the apple developer forums – Scriptable Feb 08 '18 at 09:02
  • @Scriptable Ok..I will check the links again for the solution. – Saurabh Feb 08 '18 at 09:05
  • okay, please update your question with your findings and what things you have tried already to fix the issue and it might help someone find the answer – Scriptable Feb 08 '18 at 09:09
  • Ok sure. I have worked with the urlsession but did not faced this kind of error before. – Saurabh Feb 08 '18 at 09:11
  • this does not look like a url session issue. it seems to be some issue in the project settings/project file. most solutions involved changing a setting and changing it back. i imagine this will rewrite part of the project file and maybe fix the issue. – Scriptable Feb 08 '18 at 09:12
  • Were you able to solve this? I'm encountering this and it just randomly started happening. – Luke Irvin Dec 06 '18 at 03:02
  • @LukeIrvin I don't remember what fixed the issue, just take a look to the link shared by Scriptable above. – Saurabh Jan 31 '19 at 08:54

0 Answers0