Write Function to have 4 arguments , SWIFT 4
- or -
Post a project like this1800
$20
- Posted:
- Proposals: 4
- Remote
- #2387253
- Awarded
Description
Experience Level: Entry
Need Func complete Tonight. Swift 4
Write Function to have 4 arguments , build PostData to for HTTPPOST.
Arguments are 1. SKU (String) , 2. Rating (Double) 3. RecordType (String) 4. Device (String)
Currently getting error - two many arguments.
*********************
Call>>>>>
self.queryService.rateIt(sku: XXXXXX, rating: YYYYYY ...... ) { results, errorMessage in UIApplication.shared.isNetworkActivityIndicatorVisible = false
if let results = results {
print("Xmit results \(results)")
}
**********************************************
//func rateIt(sku : String , rating : String , rtype : String) {
func rateIt(sku : String ) {
let request = NSMutableURLRequest(url: NSURL(string: "http://*************************************************.asp")! as URL)
request.httpMethod = "POST"
let postString = "CloudVersioString(describing: n\(sku)\("5")\("R")\("iPhone")"
request.httpBody = postString.data(using: String.Encoding.utf8)
let task = URLSession.shared.dataTask(with: request as URLRequest){data, response, error in
guard error == nil && data != nil else{
print("error")
return
}
if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200{
print("statusCode should be 200, but is \(httpStatus.statusCode)")
print("response = \(String(describing: response))")
}
let responseString = String(data: data!, encoding: String.Encoding.utf8)
print("responseString = \(String(describing: responseString))")
}
task.resume()
}
Write Function to have 4 arguments , build PostData to for HTTPPOST.
Arguments are 1. SKU (String) , 2. Rating (Double) 3. RecordType (String) 4. Device (String)
Currently getting error - two many arguments.
*********************
Call>>>>>
self.queryService.rateIt(sku: XXXXXX, rating: YYYYYY ...... ) { results, errorMessage in UIApplication.shared.isNetworkActivityIndicatorVisible = false
if let results = results {
print("Xmit results \(results)")
}
**********************************************
//func rateIt(sku : String , rating : String , rtype : String) {
func rateIt(sku : String ) {
let request = NSMutableURLRequest(url: NSURL(string: "http://*************************************************.asp")! as URL)
request.httpMethod = "POST"
let postString = "CloudVersioString(describing: n\(sku)\("5")\("R")\("iPhone")"
request.httpBody = postString.data(using: String.Encoding.utf8)
let task = URLSession.shared.dataTask(with: request as URLRequest){data, response, error in
guard error == nil && data != nil else{
print("error")
return
}
if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200{
print("statusCode should be 200, but is \(httpStatus.statusCode)")
print("response = \(String(describing: response))")
}
let responseString = String(data: data!, encoding: String.Encoding.utf8)
print("responseString = \(String(describing: responseString))")
}
task.resume()
}
Bill H.
100% (11)Projects Completed
11
Freelancers worked with
8
Projects awarded
70%
Last project
23 Jan 2024
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies