Http request in iOS app

I want to send an HTTP request every time myapp runs. How to do it? I'm trying to:

class MainViewController: UITableViewController {
func my_request(){

        let url = NSURL(string: "")
        let request = NSURLRequest(URL: url)
        let connection = NSURLConnection(request: request, delegate:nil, startImmediately: true)


        let lol = my_request()


But I have an error: Missing argument for parameter # 1 when called

How to fix it?



source to share

1 answer

my_request () returns nothing, if you just want to call the function use only



I would suggest putting this in the ViewDidLoad function (on your Main ViewController of your application)



All Articles