iOS app doesn't ask for location permission

前端 未结 4 802
被撕碎了的回忆
被撕碎了的回忆 2020-12-17 22:24

My Swift-iOS app is meant to show the user\'s location on a map. However, the XCode debug console tells me I need to ask permission to show the user\'s location. I think, I

4条回答
  •  借酒劲吻你
    2020-12-17 22:43

    As of iOS 8 you have to call one of the request... functions and add the appropriate entry to your Info.plist file, either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription.

    For more information, see the reference here

    Update

    Make sure that

    1. the map is centered on the simulated location.
    2. Also make sure that a location is simulated. Either do so in the Debug Area (down below) of XCode (see image), or do it in the simulator under Debug > Location.

    Debug Area: Location Simulation in the debug area

提交回复
热议问题