CLFloor returns nil in iOS 8

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.

+4
source share
3 answers

based on these two links from the Apple website

CLFloor Ref

CLLoaction Class Ref

Discussion If gender information is not available at the current location, the value of this property is zero.

, nil, , , .

+3

, WWDC 708 - Core Location Indorors, Apple Maps Connect, iOS.

, , , ​​ (, GPS) .

+8

I don’t think iOS will magically tell you the gender level from what I understand https://developer.apple.com/videos/wwdc/2014/?id=708 . You must somehow get this number differently. For instance. can you capture some iBeacon signal and from that load the floor level number or swipe the screen to find the correct floor map you are on?

0
source

Source: https://habr.com/ru/post/1545509/


All Articles