CLLocationManager startUpdatingLocation not calling locationManager:didUpdateLocations: or locationManager:didFailWithError:

前端 未结 8 1735
囚心锁ツ
囚心锁ツ 2020-12-05 06:21

I\'m trying to use the CLLocationManager framework in my iOS project to access the user\'s location but when I call

[locationManager startUpdat         


        
8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 07:19

    Location Services work a bit differently starting in iOS 8.

    Mainly, you need to add a key NSLocationWhenInUseUsageDescription to your Info.plist file, and add a description why your app need Location, such as "Location needed to ...".

    Note that you might also have to check for iOS version. Only iOS 8 and up have the Location Manager listen to the requestWhenInUseAuthorization call.

    The link below shows more details: http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/

    Good luck!

提交回复
热议问题