【发布时间】:2014-08-12 07:23:12
【问题描述】:
所以我试图让 CLFloor 在 Core Location 中为我提供数据,而不是在 Swift 中返回 nil,但我无法做到。我已经尝试了我自己的代码以及来自 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()
有谁知道如何在设备或模拟器中完成这项工作,我相信答案会让很多人受益。如果有人知道有关此或 CLVisit 的任何好的资源,那也会有所帮助。
【问题讨论】:
标签: ios swift core-location ios8