Asked 8 years ago
19 Sep 2016
Views 2361
QuickIos

QuickIos posted

Cannot invoke 'request' with an argument list of type '(String)'

i am using Alamofire for requesting data from the server


Alamofire.request("https://httpbin.org/get");


i am finding error like

Cannot invoke 'request' with an argument list of type '(String)'

i am using Alamofire 3.5 . and i find this is definition at code suggestion

Alamofire.request( URLRequest: URLRequestConvertible)

so what should i do ?

how can i convert '(String)' to '(URLRequest)'
i am very beginner for iOS coding with swift so help

jagdish

jagdish
answered Nov 30 '-1 00:00

you can use NSMutableURLRequest as below

   
let req = NSMutableURLRequest(URL: NSURL.init(string: "https://httpbin.org/get")!);
Alamofire.request(req);


hope it help !
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

NSURLRequest do the same

let res = NSURLRequest(URL: NSURL.init(string:  "https://httpbin.org/get")!);
        Alamofire.request(res)
Post Answer