So, I'm trying to get CLFloor in Core Location to give me data instead of returning nil in Swift, but I couldn’t. I tried my own code and the following from NSHipster:
import CoreLocation
class LocationManagerDelegate: NSObject, CLLocationManagerDelegate {
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: AnyObject[]!) {
let location: CLLocation? = locations[0] as? CLLocation
if let floor: CLFloor? = location?.floor {
println("Current Floor: \(floor?.level)")
}
}
}
let manager = CLLocationManager()
manager.delegate = LocationManagerDelegate()
manager.startUpdatingLocation()
Does anyone know how to do this work on a device or in a simulator, I’m sure that the answer will benefit many people. If anyone knows any good resources on this or CLVisit, this will also be helpful.
source
share