0
let headers: HTTPHeaders = [
"Accept": "application/json",
"Authorization" : "Token d3f237ec2fab24f874678029b15edfa746003111"
]
let parameters: [String:Any] = [
"firstname":fristName ,
"lastname" :lastName ,
"homeemail" : mail ,
"prorole" : [
"pro" : GymID,
"user" :"",
"role" : 9
],
"phone_details_user" : [
"phoneType" : 1 ,
"phoneNumer" : mobile
],
]
我發送數據作爲如何在Alamofire
Alamofire.request(URL, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: headers)
.responseJSON { response in
switch response.result {
case .success(let JSON):
successCallback((), JSON as Any as AnyObject)
case .failure(let error):
print(error)
}
}
它給誤差 responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(錯誤域= NSCocoaErrorDomain代碼= 3840「無效圍繞字符0值發送數據。」的UserInfo =){NSDebugDescription =無效字符周圍0值})從服務器
你能解釋一下 –
我得到了同樣的錯誤,請幫助我,同樣的事情在Android端工作正常 –
調試JSON的外觀,用某種Json驗證器測試它並檢查問題出在哪裏。 –