だから私はプログラミングに戻ってきて、問題を抱えています。関数に値を格納しているときに関数が値を返しません。見て、なぜそれが起こっているのか教えていただけますか?
func getLocation() -> NSString {
manager = OneShotLocationManager()
var tempLocation: NSString = "" // created an empty string for the var
manager!.fetchWithCompletion {location, error in
if let locatie = location {
tempLocation = String(locatie.coordinate.latitude) + "," + String(locatie.coordinate.longitude)
print(tempLocation) // It stores a value here but will not show it on the return
} else if let err = error {
tempLocation = err.localizedDescription
}
self.manager = nil
}
return tempLocation // It's not returning anything here..
}