The map couldn't show the current user location

Hi,

I’m following the MyLocation tutorial, create a mapView, but when I run the App, the map doesn’t show the blue dot (my current location), I’m sure I carefully follow the tutorial, setting the show user location to be true and done all the settings.

I also run the Finished source code of MyLocation tutorial, the blue dot is not shown neither.

Anyone could help me out?

Which edition of the book and source code are you working with? The latest ones from the sixth edition? Or an earlier edition?

I use the 5th edition, I guess there might be some changes

I tried the fifth edition source code on a simulator, ran the app and immediately switched to the map tab. There was no blue dot (or actually a yellow one in the case of Xcode 9/iOS 11) as you said.

I then ran the app again, and tapped “Get My Location” on the main tab first. That pops up a dialog asking you for permission to get location updates and once I agreed to it, I went to the map tab and then saw the dot showing the user’s location.

In order to show the user’s location, the app needs permission to get user location data from iOS. So till you agree to the prompt that asks for user information, you will not see the dot on the map view.

I do see that there is a user-experience issue here and that the map screen should ask for location permission on its own if the app already does not have location permission. Perhaps that is something that can be done as an additional exercise? :slight_smile:

Yeah, you are right, I went straight to map, and didn’t tap the “get location” to get the permission

This topic was automatically closed after 166 days. New replies are no longer allowed.