How to get user location?

后端 未结 3 1191
忘了有多久
忘了有多久 2021-01-20 09:06

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:24

    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.

提交回复
热议问题