This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ios, macos] document custom API URL & add Info.plist guide (#6833)
Also support base URL nullability in order to use default value.
- Loading branch information
Showing
7 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
The MGLNetworkConfiguration object provides a global way to set a base API URL for | ||
retrieval of map data, styles, and other resources. | ||
Currently, MGLNetworkConfiguration is private API in code but is able to be used | ||
by any applications via the `MGLMapboxAPIBaseURL` dictionary key in the | ||
application's `Info.plist`. | ||
*/ | ||
@interface MGLNetworkConfiguration : NSObject | ||
|
||
/// Returns the shared instance of the `MGLNetworkConfiguration` class. | ||
+ (instancetype)sharedManager; | ||
|
||
/// The current API base URL. | ||
@property (atomic) NSURL *apiBaseURL; | ||
/// The current API base URL. If `nil`, the Mapbox default base API URL is in use. | ||
@property (atomic, nullable) NSURL *apiBaseURL; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Info.plist Keys | ||
|
||
The Mapbox iOS SDK supports custom `Info.plist` keys in your application in order to configure various settings. | ||
|
||
## MGLMapboxAccessToken | ||
|
||
Set the [Mapbox access token](https://www.mapbox.com/help/define-access-token/) to be used by all instances of `MGLMapView` in the current application. | ||
|
||
Mapbox-hosted vector tiles and styles require an API access token, which you can obtain from the [Mapbox account page](https://www.mapbox.com/studio/account/tokens/). Access tokens associate requests to Mapbox’s vector tile and style APIs with your Mapbox account. They also deter other developers from using your styles without your permission. | ||
|
||
As an alternative, you can use `+[MGLAccountManager setAccessToken:]` to set a token in code. See [our guide](https://www.mapbox.com/help/ios-private-access-token/) for some tips on keeping access tokens in open source code private. | ||
|
||
## MGLMapboxAPIBaseURL | ||
|
||
Use this key if you need to customize the API base URL used throughout the SDK. If unset, the default Mapbox API is used. | ||
|
||
The default value is `https://api.mapbox.com`. | ||
|
||
## MGLMapboxMetricsEnabledSettingShownInApp | ||
|
||
If you have implemented custom opt-out of Mapbox Telemetry within the user interface of your app, use this key to disable the built-in check for opt-out support. See [this guide](https://www.mapbox.com/ios-sdk/#telemetry_opt_out) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Info.plist Keys | ||
|
||
The Mapbox macOS SDK supports custom `Info.plist` keys in your application in order to configure various settings. | ||
|
||
## MGLMapboxAccessToken | ||
|
||
Set the [Mapbox access token](https://www.mapbox.com/help/define-access-token/) to be used by all instances of `MGLMapView` in the current application. | ||
|
||
Mapbox-hosted vector tiles and styles require an API access token, which you can obtain from the [Mapbox account page](https://www.mapbox.com/studio/account/tokens/). Access tokens associate requests to Mapbox’s vector tile and style APIs with your Mapbox account. They also deter other developers from using your styles without your permission. | ||
|
||
As an alternative, you can use `+[MGLAccountManager setAccessToken:]` to set a token in code. See [our guide](https://www.mapbox.com/help/ios-private-access-token/) for some tips on keeping access tokens in open source code private. | ||
|
||
## MGLMapboxAPIBaseURL | ||
|
||
Use this key if you need to customize the API base URL used throughout the SDK. If unset, the default Mapbox API is used. | ||
|
||
The default value is `https://api.mapbox.com`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters