How to get user location?

后端 未结 3 1111
刺人心
刺人心 2021-01-20 08:31

I am trying to get the user\'s current location using the following code, but it doesn\'t work. I have added both NSLocationWhenInUseUsageDescription key and

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-20 09:14

    Just make sure the location manager is authorized to find user's location. You should call locationManager.requestAlwaysAuthorization() before calling for location updates.

    Also check that your simulator debugging simulates the user location.

提交回复
热议问题