Install on macOS
Minimum deployment target#
In order to use Location, you need to set your minimum deployment target to macOS 11.0 or later.
Change the first line in your
platform :osx, '11.0'
In order to request location permissions, you need to add the following to your
<key>NSLocationWhenInUseUsageDescription</key> <string>The app needs the location</string>
The string will appear in the popup when the user is asked to grant location permissions.
Ensure that the application is properly "sandboxed" and that the location is enabled. You can do this in Xcode with the following steps:
- In the project navigator, click on your application's target. This should bring up a view with tabs such as "General", "Capabilities", "Resource Tags", etc.
- Click on the "Signing and Capabilities" tab. This will give you a list of items such as "App Groups", "App Sandbox", and so on. Each item will have an "On/Off" button.
- Turn on the "App Sandbox" item and press the ">" button on the left to show the sandbox informations.
- In the "App Data" section, select "Location".
The location is not precise while using macOS since the computers don't have a GPS. Some settings will have no effect in order to keep the location as precise as possible.