This document explains how to build a development version of Mapbox iOS SDK for the purpose of incorporating it into your own Cocoa Touch application.
The Mapbox iOS SDK and iosapp demo application build against the iOS 7.0 SDK. They are intended to run on iOS 7.0 and above on the following devices and their simulators:
brew install pkg-config
Install jazzy for generating API documentation:
[sudo] gem install jazzy
/path/to/mapbox-gl-native $
, run
make ipackage # makes ./build/ios/pkg/static/
The packaging script will produce the statically-linked libMapbox.a
, Mapbox.bundle
for resources, a Headers
folder, and a Docs
folder with HTML API documentation.
make ipackage
, other make commands include
make iproj # makes ./build/ios-all/gyp/ios.xcodeproj/
After opening ios.xcodeproj
, you will see a couple of targets
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
.
In the context of your own app, you can now either:
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.podspec
to download this zip file.
{...}
m.source = {
:http => "http://{...}/mapbox-ios-sdk.zip",
:flatten => true
}
{...}
Update your app’s Podfile
to point to the Mapbox-iOS-SDK.podspec
.
pod 'Mapbox-iOS-SDK', :podspec => 'http://{...}/Mapbox-iOS-SDK.podspec'
Run pod update
to grab the newly-built library.
Built from source manually per above.
Copy the contents of build/ios/pkg/static
into your project. It should happen automatically, but ensure that:
Headers
is in your Header Search Paths (HEADER_SEARCH_PATHS
) build setting.Mapbox.bundle
is in your target’s Copy Bundle Resources build phase.libMapbox.a
is 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.framework
ImageIO.framework
MobileCoreServices.framework
QuartzCore.framework
SystemConfiguration.framework
libc++.dylib
libsqlite3.dylib
libz.dylib
Add -ObjC
to your target’s “Other Linker Flags” build setting (OTHER_LDFLAGS
).
On OS X, you can also try clearing the Xcode cache with make clear_xcode_cache
.