여기 여기 는 스위프트 : { "firstName을": "추가", "이메일 JSONSerialization SIGABRT 오류
func makeHTTPPostRequest(path: String, body: String, onCompletion: @escaping ServiceResponse) {
var err: NSError?
let request = NSMutableURLRequest(url: NSURL(string: path)! as URL)
// Set the method to POST
request.httpMethod = "POST"
// Set the POST body for the request
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try! JSONSerialization.data(withJSONObject: body, options: [])
let session = URLSession.shared
let task = session.dataTask(with: request as URLRequest, completionHandler: {data, response, error -> Void in
let json:JSON = JSON(data: data!)
onCompletion(json, err)
})
task.resume()
}
몸 변수의 값입니다 코드 (XCode8가)입니다 ... JSONSerialization에 대한 SIGABR 오류가 ":"asd ","lastName ":"add ","password ":"asdas "}
도움이 될 것입니다!
할 필요가 ... –