I want to send http request on every myapp-starting. How to do this? I try:
class MainViewController: UITableViewController {
func my_request(){
let url = NSURL(string: "http://www.stackoverflow.com")
let request = NSURLRequest(URL: url)
let connection = NSURLConnection(request: request, delegate:nil, startImmediately: true)
println(connection)
}
let lol = my_request()
}
But I have an error: Missing argument for parameter #1 in call
How to fix that?
Thanks!
my_request() returns nothing, if you just want to call the function, use only
my_request()
I would suggest to put this in the ViewDidLoad function (on your Main ViewController of your App)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With