iOS app doesn't ask for location permission

前端 未结 4 800
被撕碎了的回忆
被撕碎了的回忆 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:33

    As David Berry, Cayke Prudente and Levi Johnson mentioned, I just needed to add NSLocationAlwaysUsageDescription to my Info.plist file. To understand more WHY I needed this, I went for further documentation and I'm sharing here, as it can help others the same way they helped me.

    The user prompt contains the text from the NSLocationWhenInUseUsageDescription key in your app’s Info.plist file, and the presence of that key is required when calling this method.

    https://developer.apple.com/documentation/corelocation/cllocationmanager/1620562-requestwheninuseauthorization

提交回复
热议问题