![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Swift) Transition from Http.SynchronousRequest to Http.HttpSReqProvides instructions for replacing deprecated SynchronousRequest method calls with HttpSReq. Note: This example requires Chilkat v11.0.0 or greater.
func chilkatTest() { let http = CkoHttp()! var domain: String? = "example.com" var port: Int = 443 var tls: Int = true let req = CkoHttpRequest()! req.httpVerb = "POST" req.path = "/some/path" req.contentType = "application/x-www-form-urlencoded" req.addParam("firstName", value: "Matt") req.addParam("lastName", value: "Smith") // ------------------------------------------------------------------------ // The SynchronousRequest method is deprecated: var responseObj: CkoHttpResponse? = http.synchronousRequest(domain, port: port, ssl: tls, req: req) if http.lastMethodSuccess == false { print("\(http.lastErrorText!)") return } // ... // ... responseObj = nil // ------------------------------------------------------------------------ // Do the equivalent using HttpSReq. // 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.httpSReq(domain, port: port, ssl: tls, request: req, response: responseOut) if success == false { print("\(http.lastErrorText!)") return } } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.