Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Upgrading from Mapbox Maps SDK for iOS v3.7.x to v4.0.x

Minh Nguyễn edited this page May 4, 2018 · 6 revisions

Mapbox Maps SDK for iOS v4.0.0 is the first major version of this SDK since 2015. To upgrade, follow the installation instructions, or run pod update with CocoaPods or carthage update with Carthage.

Version 4.0.0 contains a number of important changes. There are several backwards-incompatible changes to be aware of as you upgrade, which are discussed below.

Style layers

We made a number of improvements to give you more control over the appearance of a map’s style. These improvements required us to make the following backwards-incompatible API changes to MGLStyleLayer and its subclasses:

  • The layout and paint properties on subclasses of MGLStyleLayer are now of type NSExpression instead of MGLStyleValue. MGLStyleValue has been removed. This guide shows you how to migrate your runtime styling code to NSExpression. The “Predicates and Expressions” guide contains full details on how to write expressions that are compatible with style layers.
  • A small number of NSPredicates written for v3.7.x may need to cast feature attributes to the correct type, as described in this section of the predicate guide.

Renamed APIs

You’ll need to account for the following renamed APIs. Xcode automatically provides fix-it suggestions wherever your code needs to change:

Old New Languages affected
MGLRasterSource MGLRasterTileSource Objective-C and Swift
MGLVectorSource MGLVectorTileSource Objective-C and Swift
MGLStyle.streetsStyleURL() etc. MGLStyle.streetsStyleURL etc. Swift only
MGLOfflineStorage.shared() MGLOfflineStorage.shared Swift only
MGLAccountManager.setAccessToken("pk.…") MGLAccountManager.accessToken = "pk.…" Swift only

Other changes

Any classes, methods, or properties that were deprecated in v3.7.6 are no longer available. See your project’s build errors for details about replacements.

The SDK no longer supports 32-bit simulators, such as the iPhone 5 and iPad 2 simulators. The SDK continues to support 32-bit devices, but note that the minimum iOS deployment version will increase to iOS 9.0 in a future release.

If you have any questions, please contact Mapbox’s support team.

Clone this wiki locally