मैं इस तरह की एक पोस्ट शरीर पैरामीटर:विषम संग्रह शाब्दिक केवल '[स्ट्रिंग: कोई भी]' का अनुमान लगाया जा सकता है; स्पष्ट प्रकार टिप्पणी जोड़ने अगर यह जानबूझकर है
{
"id": 0,
"name": "string",
"contactInfo": "string",
"message": "string"
}
तो के बाद से मैं Alamofire उपयोग कर रहा हूँ मापदंडों पोस्ट करने के लिए मैं इस तरह के बाद शरीर शब्दकोश का वर्णन कर रहा हूँ:
let body = ["id": userID, "name": userName, "contactInfo": contactInfo, "message": message]
class func postUserFeedback(userID: Int, userName: String, contactInfo: String, message: String,completionHandler: @escaping (FeedbackResponse?) -> Void) {
let body = ["id": userID, "name": userName, "contactInfo": contactInfo, "message": message]
request(route: .userFeedback, body: body).responseObject { (response: DataResponse<FeedbackResponse>) in
response.result.ifSuccess({
completionHandler(response.result.value)
})
response.result.ifFailure {
completionHandler(nil)
}
}
}
लेकिन मैं हो रही है इस तरह त्रुटि:
क्या मैं इस वाक्य रचना में गलत कर रहा हूँ?