Struct apple_bundle::info_plist::protected_resources::Location[][src]

pub struct Location {
    pub location_always_and_when_in_use_usage_description: Option<String>,
    pub location_usage_description: Option<String>,
    pub location_when_in_use_usage_description: Option<String>,
    pub location_temporary_usage_description_dictionary: Option<DefaultDictionary>,
    pub location_always_usage_description: Option<String>,
    pub widget_wants_location: Option<bool>,
    pub location_default_accuracy_reduced: Option<bool>,
}
Expand description

Fields

location_always_and_when_in_use_usage_description: Option<String>

A message that tells the user why the app is requesting access to the user’s location information at all times.

Use this key if your iOS app accesses location information while running in the background. If your app only needs location information when in the foreground, use NSLocationWhenInUseUsageDescription instead. For more information, see Choosing the Location Services Authorization to Request.

If you need location information in a macOS app, use NSLocationUsageDescription instead. If your iOS app deploys to versions earlier than iOS 11, see NSLocationAlwaysUsageDescription.

Important

This key is required if your iOS app uses APIs that access the user’s location information at all times.

Availability

  • iOS 11.0+

Framework

  • Core Location
location_usage_description: Option<String>
👎 Deprecated since iOS 6.0–8.0

A message that tells the user why the app is requesting access to the user’s location information.

Use this key in a macOS app that accesses the user’s location information. In an iOS app, use NSLocationWhenInUseUsageDescription or NSLocationAlwaysAndWhenInUseUsageDescription instead.

Important

This key is required if your macOS app uses APIs that access the user’s location information.

Availability

  • iOS 6.0–8.0
  • macOS 10.14+

Framework

  • Core Location
location_when_in_use_usage_description: Option<String>

A message that tells the user why the app is requesting access to the user’s location information while the app is running in the foreground.

Use this key if your iOS app accesses location information only when running in the foreground. If your app needs location information when in the background, use NSLocationAlwaysAndWhenInUseUsageDescription instead. For more information, see Choosing the Location Services Authorization to Request.

If you need location information in a macOS app, use NSLocationUsageDescription instead.

Important

This key is required if your iOS app uses APIs that access the user’s location information while the app is in use.

Availability

  • iOS 11.0+

Framework

  • Core Location
location_temporary_usage_description_dictionary: Option<DefaultDictionary>

A collection of messages that explain why the app is requesting temporary access to the user’s location.

Use this key if your app needs temporary access to full accuracy location information. Provide a dictionary of messages that address different use cases, keyed by strings that you define. For example, if your app suggests nearby coffee shops in one part of the app, and finds nearby friends in another, you could include two entries

When you request access, select among the messages at run time by providing the associated key to the requestTemporaryFullAccuracyAuthorization(withPurposeKey:) method:

// Request location access to find coffee shops.
manager.requestTemporaryFullAccuracyAuthorization(withPurposeKey: "coffee")

Availability

  • iOS 14.0+
  • macOS 11.0+

Framework

  • Core Location
location_always_usage_description: Option<String>
👎 Deprecated since iOS 8.0–10.0:

For apps deployed to targets in iOS 11 and later, use NSLocationAlwaysAndWhenInUseUsageDescription instead.

A message that tells the user why the app is requesting access to the user’s location at all times.

Use this key if your iOS app accesses location information in the background, and you deploy to a target earlier than iOS 11. In that case, add both this key and NSLocationAlwaysAndWhenInUseUsageDescription to your app’s Info.plist file with the same message. Apps running on older versions of the OS use the message associated with NSLocationAlwaysUsageDescription, while apps running on later versions use the one associated with NSLocationAlwaysAndWhenInUseUsageDescription.

If your app only needs location information when in the foreground, use NSLocationWhenInUseUsageDescription instead. For more information, see Choosing the Location Services Authorization to Request.

If you need location information in a macOS app, use NSLocationUsageDescription instead.

Important

This key is required if your iOS app uses APIs that access the user’s location at all times and deploys to targets earlier than iOS 11.

Availability

  • iOS 8.0–10.0

Framework

  • Core Location
widget_wants_location: Option<bool>

A Boolean value that indicates a widget uses the user’s location information.

To access the user’s location information from a widget, set the value to true in the widget extension’s Info.plist file.

Before a widget can access location information, the containing app must request authorization from the user. The containing app’s Info.plist file must also contain relevant purpose strings. For more information, see Requesting Authorization for Location Services.

Availability

  • iOS 14.0+
  • macOS 11.0+

Framework

  • WidgetKit
location_default_accuracy_reduced: Option<bool>

A Boolean value that indicates whether the app requests reduced location accuracy by default.

Include this key in your information property list to set your app’s default behavior for location accuracy when it calls the Core Location framework. Set the key value to true to prompt the user for reduced accuracy by default; set it to false to prompt for full location accuracy. If you don’t include that key in your Info.plist, that’s equivalent to setting it to false.

Include the key pair in your Info.plist file as shown:

NSLocationDefaultAccuracyReduced

When this key is set to true, all Core Location services (location updates, visit monitoring, significant location change, fence monitoring) receive service at the reduced-accuracy service level. Users will see that your app is asking for reduced accuracy because the location authorization prompt will show a map with an approximate location, and your app will have the Precise Location toggled off in Settings > Privacy > Location Services . These indicators of an app’s improved privacy are ones that users may value.

If you want to leverage the reduced-accuracy feature to improve privacy in a particular operation without setting this key, use the desiredAccuracy constant kCLLocationAccuracyReduced. This constant causes startUpdatingLocation() to deliver results as if the app were authorized for approximate location until you change the desiredAccuracy constant again.

Setting NSLocationDefaultAccuracyReduced determines the default type of authorization your app gets, but users can override it any time in Settings. Users always control the level of location accuracy they want to share, and can change precision settings in Settings > Privacy > Location Services by selecting Precise Location for your app.

Availability

  • iOS 14.0+
  • watchOS 7.0+

Framework

  • Core Location

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.