CLLocationManager.location is nil

后端 未结 2 1325
旧时难觅i
旧时难觅i 2021-01-02 08:09

this is my locationManager init method:

func initLocationManager() {
        seenError = false
        locationFixAchieved = false
        locationManager =          


        
相关标签:
2条回答
  • 2021-01-02 08:43

    As of iOS 8 requestAlwaysAuthorization is ignored if you do not provide a string for NSLocationAlwaysUsageDescription in your Info.plist.

    Link to documentation

    0 讨论(0)
  • 2021-01-02 08:46

    1) CLLocation location documentation - The value of this property is nil if no location data has ever been retrieved.

    2) You've set the delegate for CLLocationManager. Why not implement locationManager:didUpdateLocations: and print the latest retrieved location from inside?

    3) Are you using a simulator or a real device? Bear in mind that if you are using a simulator you may need to enable simulate location:

    Xcode location Dropdown

    You can also find a Custom Location option in: - Simulator -> Debug -> Location -> Custom Location...

    0 讨论(0)
提交回复
热议问题