Location Services not working in iOS 11

前端 未结 8 567
春和景丽
春和景丽 2020-11-27 14:59

I just rebuilt my app with the iOS 11 SDK in an attempt to remove the blue banner that is now always appearing. I thought - \"Brilliant, that worked\", only to

8条回答
  •  余生分开走
    2020-11-27 15:38

    Follow these steps:

    I ran into the same issue with an app that needed "Always Authorization", and resolved it by following these steps:

    1. Add NSLocationWhenInUseUsageDescription key to Info.plist

    2. Add NSLocationAlwaysAndWhenInUseUsageDescription to Info.plist

    3. Add NSLocationAlwaysUsageDescription to Info.plist (to support < iOS 11)

    4. Call requestWhenInUseAuthorization() BEFORE requestAlwaysAuthorization()

    You cannot execute requestAlwaysAuthorization() before requestWhenInUseAuthorization(). You must escalate to that permission level. Once I made these changes, location updates started working properly again.

    More details can be found here:

    https://developer.apple.com/documentation/corelocation/choosing_the_authorization_level_for_location_services/requesting_always_authorization

提交回复
热议问题