These changes dropped out of #3416 somehow. The screenshots only make sense inside the gyp-generated project, which is irrelevant in this case.
3.2 KiB
Integrating the Mapbox iOS SDK into your application
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.
Requirements
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:
- iPhone 4S and above (5, 5c, 5s, 6, 6 Plus)
- iPad 2 and above (3, 4, Mini, Air, Mini 2, Air 2)
- iPod touch 5th generation and above
Build
-
Install jazzy for generating API documentation:
[sudo] gem install jazzy -
Run
make ipackage. The packaging script will produce the statically-linkedlibMapbox.a,Mapbox.bundlefor resources, aHeadersfolder, and aDocsfolder with HTML API documentation.
Install
There are two ways to install the Mapbox iOS SDK:
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.dylib
-
Add
-ObjCto your target's "Other Linker Flags" build setting (OTHER_LDFLAGS).
Use
-
Mapbox vector tiles require a Mapbox account and API access token. In the project editor, select the application target. In the Info tab, set
MGLMapboxAccessTokento your access token. You can obtain one from the Mapbox account page. -
In a XIB or storyboard, add a View and set its custom class to
MGLMapView. If you need to manipulate the map view programmatically, import theMapboxmodule (Swift) orMapbox.humbrella header (Objective-C).
Troubleshooting
On OS X, you can also try clearing the Xcode cache with make clear_xcode_cache.