3.0 KiB
Building Mapbox GL Native for iOS
This section is for people contributing to Mapbox GL directly in the context of their own app.
Build
-
Install appledoc for API docs generation.
curl -L -o appledoc.zip https://github.com/tomaz/appledoc/releases/download/v2.2-963/appledoc.zip unzip appledoc.zip cp appledoc /usr/local/bin cp -Rf Templates/ ~/.appledoc -
Run
make ipackage. The packaging script will produce the statically-linkedlibMapbox.a,Mapbox.bundlefor resources, aHeadersfolder, and aDocsfolder with HTML API documentation.
Access Tokens
The demo applications use Mapbox vector tiles, which require a Mapbox account and API access token. Obtain an access token on the Mapbox account page.
Set up the access token by editing the scheme for the application target, then adding an environment variable with the name MAPBOX_ACCESS_TOKEN.
Test
In the context of your own app, you can now either:
CocoaPods
Currently, until #1437 is completed, to install a development version of Mapbox GL using CocoaPods you will need to build it from source manually per above.
-
Zip up the build product.
cd build/ios/pkg/static ZIP=mapbox-ios-sdk.zip rm -f ../${ZIP} zip -r ../${ZIP} * -
Modify a custom
Mapbox-iOS-SDK.podspecto download this zip file.{...} m.source = { :http => "http://{...}/mapbox-ios-sdk.zip", :flatten => true } {...} -
Update your app's
Podfileto point to theMapbox-iOS-SDK.podspec.pod 'Mapbox-iOS-SDK', :podspec => 'http://{...}/Mapbox-iOS-SDK.podspec' -
Run
pod updateto grab the newly-built library.
Binary
-
Built from source manually per above.
-
Copy the contents of
build/ios/pkg/staticinto your project. It should happen automatically, but ensure that:Headersis in your Header Search Paths (HEADER_SEARCH_PATHS) build setting.Mapbox.bundleis in your target's Copy Bundle Resources build phase.libMapbox.ais in your target's Link Binary With Libraries build phase.
-
Add the following Cocoa framework dependencies to your target's Link Binary With Libraries build phase:
GLKit.frameworkImageIO.frameworkMobileCoreServices.frameworkQuartzCore.frameworkSystemConfiguration.frameworklibc++.dyliblibsqlite3.dyliblibz.dylibCoreTelephony.framework(optional, telemetry-only)
-
Add
-ObjCto your target's "Other Linker Flags" build setting (OTHER_LDFLAGS).
Troubleshooting
On OS X, you can also try clearing the Xcode cache with make clear_xcode_cache.

