-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Upgrading from Mapbox Maps SDK for iOS v3.7.x to v4.0.x
Mapbox Maps SDK for iOS v4.0.0 is the first major version of this SDK since 2015. To upgrade, follow the installation instructions. If you use CocoaPods or Carthage, update the version to ~> 4.0
, then run pod update
or carthage update
.
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.
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 typeNSExpression
instead ofMGLStyleValue
.MGLStyleValue
has been removed. The “Migrating to Expressions” guide shows you how to migrate your runtime styling code toNSExpression
. The “Predicates and Expressions” guide contains full details on how to write expressions that are compatible with style layers. - A small number of
NSPredicate
s written for v3.7.x may need to cast feature attributes to the correct type, as described in this section of the predicate guide.
Additionally, MGLRasterSource
was renamed MGLRasterTileSource
and MGLVectorSource
was renamed MGLVectorTileSource
. Xcode automatically provides fix-it suggestions for these changes.
If your application is written in Swift, you’ll need to account for the following class methods being converted into class properties. Xcode automatically provides fix-it suggestions for these changes as well:
Old | New |
---|---|
MGLStyle.streetsStyleURL() etc. |
MGLStyle.streetsStyleURL etc. |
MGLOfflineStorage.shared() |
MGLOfflineStorage.shared |
MGLAccountManager.setAccessToken("pk.…") |
MGLAccountManager.accessToken = "pk.…" |
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 MGLStyle.localizesLabels
property has been replaced by an -[MGLStyle localizeLabelsIntoLocale:]
method that applies the same effect. See this guide for more details.
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. 32-bit simulator support was temporarily restored in v4.0.1 for CocoaPods compatibility, but it will be removed at some point in the future along with 32-bit device support.
If you have any questions, please contact Mapbox’s support team.
Workflow: Code, Makefile, CMake, Xcode, ccache, Debugging, CI, JS/Native, Code Generation, Versions & Tagging, Contributing, Troubleshooting
Architecture: Threads, Immutability, Expressions, Text Rendering, Collision Detection, CJK Text
Rendering: OpenGL, Coordinate Systems
Android: checkstyle, APK Size, 4→5, 5→6, 6→7, Symbolication
iOS/macOS: 3→4
Releasing: iOS, macOS, Merging back
Misc: Terminology