Reputation: 11
I get this error and I have no idea why I get it. It is not shown in the picture but I do import UIKit
and Alamofire
. It would be great if you could let me know what the problem is.
I think the main problem is in the Alamofire.request(.GET, currentWeatherURL)
part.
func downloadWeatherDetails(completed: DownloadComplete) {
//Alamofire Download
let currentWeatherURL = URL(string: CURRENT_WEATHER_URL)!
Alamofire.request(.GET, currentWeatherURL).responseJSON { response in
let result = response.result
print(result)
}
}
Upvotes: 1
Views: 1798
Reputation: 58049
There are several issues with your code:
method
.Alamofire
.URL
initializer - moreover, Alamofire
does this for you automatically, just pass the string as a parameter.Here is your code, fixed:
func downloadWeatherDetails(completed: DownloadComplete) {
Alamofire.request(CURRENT_WEATHER_URL, method: .get).responseJSON { response in
let result = response.result
print(result)
}
}
Upvotes: 3