/ / Netzwerkanruf nicht möglich - schnelle Netzwerkprogrammierung

Kein Netzwerkanruf möglich - schnelle Netzwerkprogrammierung

Ich versuche, für eine Wettervorhersage einen Forecast-Aufruf von Forecast.io durchzuführen. Mein Code sieht wie folgt aus:

class ViewController: UIViewController {

private let apiKey = "" // 32 letters and numbers

override func viewDidLoad() {
super.viewDidLoad()


let baseURL = NSURL(string: "https://developer.forecast.io/forecast/(apiKey)/")
let forecastURL = NSURL(string: "37.8267,-122.423", relativeToURL: baseURL)

let weatherData = NSData(contentsOfURL: forecastURL!, options: nil, error: nil)

println(weatherData)
}


}

Das println () gibt nur Null zurück. Wenn ich mich bei Forecast.io anmelde, sehe ich, dass noch kein Anruf erfolgt ist.

Antworten:

0 für die Antwort № 1

Das Problem liegt in der URL:

"https://developer.forecast.io/forecast/

sollte sein

"https://api.forecast.io/forecast/