Coder Social home page Coder Social logo

keith / mapbox-events-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mapbox/mapbox-events-ios

1.0 3.0 0.0 27.91 MB

Mapbox telemetry for iOS

License: Other

Objective-C 71.64% Ruby 0.49% Objective-C++ 20.41% HTML 0.28% Makefile 0.33% C 4.61% Shell 1.71% JavaScript 0.52%

mapbox-events-ios's Introduction

🎟 Mapbox Mobile Events

Bitrise codecov

The Mapbox Mobile Events SDK collects anonymous data about the map and device location to continuously update and improve your maps.

📦 Client Frameworks

📖 Quick Start

Include MapboxMobileEvents.framework in your application, in the application delegate's …didFinishLaunching… method, add:

MMEEventsManager *manager = [MMEventsManager.sharedManager 
    initializeWithAccessToken:@"your-mapbox-token" 
    userAgentBase:@"user-agent-string"
    hostSDKVersion:@"1.0.0"];
manager.delegate = self;
manager.isMetricsEnabledInSimulator = YES;
manager.isDebugLoggingEnabled = (DEBUG ? YES : NO);
[manager sendTurnstileEvent];

Or, in Swift:

let eventsManager = MMEEventsManager.sharedManager().initialize(
    withAccessToken: "your-mapbox-token", 
    userAgentBase: "user-agent-string", 
    hostSDKVersion: "1.0.0")
eventsManager.delgate = self;
eventsManager.isMetricsEnabledInSimulator = true
eventsManager.isDebugLoggingEnabled = (DEBUG ? true : false)
eventsManager.sendTurnstileEvent()

🗺 Foreground and Background Location Collection

The MapboxMobileEvents frameworks collect location data to help us improve the map. We strive to maintain a low power and network usage profile for this collection and take great care to anonymize all data in accordance with our privacy policy.

The use of Mapbox SDKs and APIs on mobile devices are governed by our Terms of Service which requires your app not interfere with or limit the data that the Mapbox SDK sends to us, whether by modifying the SDK or by other means. If your application requires different terms, please contact Mapbox Sales.

Background Location in iOS 13

If your application enables background location, the MapboxMobileEvents framework collects telemetry in the background using a passive method which allows for very low power usage. If your application does not use background location, make sure that the permissions keys for it are removed in the Info.plist: NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription, as well as the UIBackgroundMode location.

⚠️ Error and Exception Handling and Reporting

The MapboxMobileEvents frameworks strives to contain all internal exceptions and errors in an effort to prevent errors from directly impacting the end users of applications which use the framework. The framework will attempt to report them to our backend, in a redacted form, for analysis by Mapbox.

Applications and frameworks which embed MapboxMobileEvents.framework can implement the MMEEventsManagerDelegate method:

- (void)eventsManager:(MMEEventsManager *)eventsManager 
    didEncounterError:(NSError *)error;

to be informed of any NSErrors or NSExceptions the framework encounters. NSExceptions are reported wrapped in an NSError with the error code MMEErrorException and the exception included in the user info dictionary under the key MMEErrorUnderlyingExceptionKey.

If a framework wishes to report errors via the mobile events API two convenience methods are provided on MMEEventsManager:

NSError *reportableError = nil;
// make a call with an **error paramater
[MMEEventsManager.sharedManager reportError:reportableError];

@try {
    // do something dangerous
}
@catch (NSException *exceptional) {
    [MMEEventsManager.sharedManager reportException:exceptional];
}

🧪 Testing

Test cases are written using Cedar, to run the test in Xcode using Command-U you'll need to install the framework:

# install carthage
brew install carthage

# bootstrap the project
cd $PROJECT_DIR
carthage bootstrap
<style> body { margin: 2em; max-width: 512pt; margin-right:auto; margin-left:auto; font-family: Helvetica, sans-serif; } pre { border: 1px solid gray; padding: 1em; margin: 1em; } </style>

mapbox-events-ios's People

Contributors

rclee avatar boundsj avatar alfwatt avatar friedbunny avatar vincethecoder avatar julianrex avatar captainbarbosa avatar andrlee avatar 1ec5 avatar ericrwolfe avatar frederoni avatar lloydsheng avatar bsudekum avatar harvsu avatar mick avatar m-stephen avatar

Stargazers

joleary1987 avatar

Watchers

Keith Smiley avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.