guys! Once again my app is crashing and I don't have a clue to what to do. Does anyone could help out?! By the way, I'm beginner.. I'm learning. Please, be kind.
AF.request(URL_USER_ADD, method: .post, parameters: body, encoding: JSONEncoding.default, headers: header).responseJSON { (response) in
switch response.result {
case .success(let result):
if let json = result as? Data {
guard let data = response.data else { return }
let json = JSON(data: data)
let id = json["_id"].stringValue
let color = json["avatarColor"].stringValue
let avatarName = json["avatarName"].stringValue
let email = json["email"].stringValue
let name = json["name"].stringValue
UserDataService.instance.setUserData(id: id, color: color, avatarName: avatarName, email: email, name: name)
completion(true)
} else {
completion(false)
debugPrint(response.result as Any)
Check it out the image of the error!
Thanks!