(Swift) Transition from Http.QuickGetObj to Http.HttpNoBody
Provides instructions for replacing deprecated QuickGetObj method calls with HttpNoBody. Note: This example requires Chilkat v11.0.0 or greater.
func chilkatTest() {
let http = CkoHttp()!
var url: String? = "https://example.com/"
// ------------------------------------------------------------------------
// The QuickGetObj method is deprecated:
var responseObj: CkoHttpResponse? = http.quickGetObj(url)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
// ...
// ...
responseObj = nil
// ------------------------------------------------------------------------
// Do the equivalent using HttpNoBody.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
let responseOut = CkoHttpResponse()!
var success: Bool = http.httpNoBody("GET", url: url, response: responseOut)
if success == false {
print("\(http.lastErrorText!)")
return
}
}
|