iOS SDK
Tutorials
API Reference
- MGLTileCoordinateSystem
- MGLComputedShapeSource
- MGLSphericalPosition
- MGLUserLocationAnnotationViewStyle
- MGLDistanceFormatter
- MGLStyleLayer
- MGLMapDebugMaskOptions
- MGLSymbolZOrder
- MGLShape
- MGLLineTranslationAnchor
- MGLMultiPoint
- MGLOfflinePack
- Style Primitives
- MGLMultiPolyline
- MGLTextAnchor
- Primitive Shapes
- MGLIconTranslationAnchor
- NSValue(MGLFillStyleLayerAdditions)
- MGLAnnotation
- NSExpression(MGLAdditions)
- MGLTextJustification
- MGLUserLocationAnnotationView
- MGLMultiPolygon
- MGLCircleStyleLayer
- MGLCoordinateSpan
- MGLNetworkConfiguration
- MGLTextWritingMode
- Other Enumerations
- MGLUserLocation
- MGLCalloutView
- MGLAttributedExpression
- MGLImageSource
- MGLOfflinePackProgress
- MGLIconAnchor
- MGLFillStyleLayer
- MGLFillTranslationAnchor
- Appendices
- MGLOfflinePackProgress
- MGLComputedShapeSourceDataSource
- NSValue(MGLLineStyleLayerAdditions)
- MGLStylable
- MGLRasterResamplingMode
- Geometry
- MGLPolygon
- Location Updates
- MGLClockDirectionFormatter
- NSValue(MGLFillExtrusionStyleLayerAdditions)
- MGLCoordinateSpan
- MGLCluster
- MGLErrorCode
- MGLAccountManager
- MGLForegroundStyleLayer
- MGLRasterTileSource
- MGLTextPitchAlignment
- MGLResourceKind
- MGLMapSnapshotterDelegate
- MGLAnnotationImage
- MGLHillshadeStyleLayer
- MGLOrnamentPosition
- MGLAnnotationViewDragState
- MGLDEMEncoding
- MGLSource
- MGLIconPitchAlignment
- MGLCalloutViewDelegate
- MGLVectorStyleLayer
- MGLRasterStyleLayer
- MGLLoggingConfiguration
- MGLLightAnchor
- Other Categories
- MGLTransition
- MGLLocationManager
- MGLLoggingLevel
- MGLTextTranslationAnchor
- MGLCompassButton
- MGLShapeSource
- NSValue(MGLRasterStyleLayerAdditions)
- MGLAnnotationVerticalAlignment
- MGLPolyline
- Maps
- MGLMapCamera
- MGLOfflineStorage
- Other Type Definitions
- MGLSphericalPosition
- MGLShapeCollection
- NSValue(MGLAdditions)
- Style Content
- MGLSymbolPlacement
- MGLTransition
- Other Classes
- MGLPointCollection
- MGLMapViewDelegate
- Style Layers
- MGLMapSnapshotOverlay
- MGLCoordinateQuad
- MGLTextTransform
- MGLOverlay
- MGLUserTrackingMode
- MGLTileSource
- MGLHillshadeIlluminationAnchor
- MGLTextRotationAlignment
- NSValue(MGLHillshadeStyleLayerAdditions)
- MGLOfflinePackState
- Formatters
- MGLLocationManagerDelegate
- MGLAttributionInfoStyle
- MGLBackgroundStyleLayer
- Styling the Map
- MGLCoordinateBounds
- MGLFillExtrusionTranslationAnchor
- Offline Maps
- MGLCoordinateFormatter
- MGLOrnamentVisibility
- MGLStyle
- MGLFeature
- MGLOfflineRegion
- MGLMapView
- MGLShapeOfflineRegion
- Other Structures
- MGLCirclePitchAlignment
- NSValue(MGLCircleStyleLayerAdditions)
- MGLMapSnapshot
- MGLFillExtrusionStyleLayer
- MGLCoordinateQuad
- MGLMapSnapshotOptions
- Other Protocols
- MGLLineCap
- MGLSymbolStyleLayer
- Other Functions
- MGLCircleTranslationAnchor
- MGLLineJoin
- MGLAnnotationView
- MGLCircleScaleAlignment
- MGLPointAnnotation
- MGLMapSnapshotter
- MGLLineStyleLayer
- MGLAttributionInfo
- MGLCompassDirectionFormatter
- MGLCoordinateBounds
- MGLTilePyramidOfflineRegion
- MGLIconRotationAlignment
- MGLIconTextFit
- Other Constants
- NSValue(MGLSymbolStyleLayerAdditions)
- Annotations
- MGLLight
- MGLHeatmapStyleLayer
- MGLOfflineStorageDelegate
- MGLVectorTileSource
- User Interaction
On This Page
MGLAccountManager
@interface MGLAccountManager : NSObject
The MGLAccountManager
object provides a global way to set a Mapbox API access token.
Authorizing Access
accessToken
The Mapbox access token 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. 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.
Setting this property to a value of nil
has no effect.
Note
You must set the access token before attempting to load any Mapbox-hosted style. Therefore, you should generally set it before creating an instance of MGLMapView
. The recommended way to set an access token is to add an entry to your application’s Info.plist file with the key MGLMapboxAccessToken
and the type String
. Alternatively, you may call this method from your application delegate’s -applicationDidFinishLaunching:
method.
Declaration
Objective-C
@property (class, atomic, copy, readwrite, nullable) NSString *accessToken;
Swift
class var accessToken: String? { get set }