Files
MapLibreParticleLab/platform/ios/DEVELOPING.md
2016-02-26 10:23:40 -08:00

3.3 KiB

Contributing to the Mapbox iOS SDK

This document explains how to build the Mapbox iOS SDK from source. It is intended for advanced developers who wish to contribute to Mapbox GL and the Mapbox iOS SDK.

Requirements

The Mapbox iOS SDK and iosapp demo application build against the iOS 7.0 SDK and require Xcode on a computer running OS X.

Build

Install core dependencies, then run

make iproj

Which will create and open an Xcode project that can build the entire library from source, as well as an Objective-C test app. Before building, use the scheme picker button in the toolbar to change the scheme from “All (ios project)” to “iosapp” and the destination from “My Mac” to one of the simulators or connected devices listed in the menu.

If you don't have an Apple Developer account, change the destination from "My Mac" to a simulator such as "iPhone 6" before you run and build the app.

ipackage is only one of several available make build targets. Others include:

  • make ipackage builds both dynamic and static frameworks in the Release configuration for devices and the iOS Simulator.
  • make ipackage-sim builds a dynamic framework in the Debug configuration for the iOS simulator. This is the fastest target.
  • make ipackage-strip builds both dynamic and static frameworks in the Release configuration, stripped of debug symbols, for devices and the iOS Simulator.
  • make iframework builds a dynamic framework in the Release configuration for devices and the iOS Simulator. The CocoaPods pod downloads the output of this target.

You can customize the build output by passing the following arguments into the make invocation:

  • BITCODE=NO builds without Bitcode support.
  • BUILD_DEVICE=false builds only for the iOS Simulator.
  • FORMAT=dynamic builds only a dynamic framework. FORMAT=static builds only a static framework, for compatibility with iOS 7.x.
  • SYMBOLS=NO strips the build output of any debug symbols, yielding much smaller binaries.

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.

edit scheme

setting access token in Xcode scheme

Test

Run

make itest

To run the included integration tests on the command line.

If you want to run the tests in Xcode instead, first make ipackage to create a local static library version, then open platform/ios/test/ios-tests.xcodeproj, and lastly Command + U on the Mapbox GL Tests application target.

Usage

  • Pan to move
  • Pinch to zoom
  • Use two fingers to rotate
  • Double-tap to zoom in one level
  • Two-finger single-tap to zoom out one level
  • Double-tap, long-pressing the second, then pan up and down to "quick zoom" (iPhone only, meant for one-handed use)
  • Use the debug menu to add test annotations, reset position, and cycle through the debug options.