Errors caused by client code should be communicated through NSExceptions. NSAsserts are intended for internal usage; because they include helpful information like the absolute path to the file containing the assertion, stripping the build (#1650) also strips assertion messages. Also replaced hardcoded references to methods in these messages with __PRETTY_FUNCTION__, which avoids future copy-pasta and handles cases in which the MGL class has been subclassed.
Added lightweight generics annotations to collection-typed method and protocol signatures to streamline usage of these members in Swift. Lightweight generic type specifiers are wrapped in conditionally-compiled macros for compatibility with Xcode 6.x.
Manually preprocess the NS_*_OF() macros in a temporary copy of each header before appledoc sees the headers. Also removed the --ignore flag because we no longer have a private headers folder under include/mbgl/ios/.
Added some nullability qualifiers in method implementation selectors for consistency with declarations.
The user dot view now has a non-zero size. Previously only its layer was sized properly. Also resolved some pedantic warnings about missing designated initializer overrides.
Xcode 6.3 or above is now required for building this project.
Need to look in the main bundle for Info.plist settings, because the developer has no access to the framework’s Info.plist. Need to check MGLMapboxMetricsEnabledSettingShownInApp before MGLMapboxAccessToken; otherwise, `MGLMapboxEvents` inspects the Settings bundle plist before MGLMapboxMetricsEnabledSettingShownInApp is even checked.
`-pauseMetricsCollection` and `-resumeMetricsCollection` were originally introduced to mitigate concerns around battery usage, but `MGLMapboxEvents` has since evolved to tread much lighter on the battery. There’s no longer any need for the client to call these methods directly. The iOS test project now includes MGLMapboxEvents.h explicitly to avoid having to package a header that will go unused.
That way there’s no ambiguity about when you should call things like `+[MGLAccountManager setMapboxMetricsEnabledSettingShownInApp:]`. In fact, that method is now deprecated because it’s so easy to call in the wrong place.
Fixes#1535.
Enable Mapbox Metrics by default when Settings.bundle is absent, but allow Settings.bundle to override the default. Don’t register defaults for non-Mapbox preferences. The two-phase registration ensures that the defaults don’t default to unexpected values, yet gives the developer a chance to call `+[MGLAccountManager mapboxMetricsEnabledSettingShownInApp]` before the hard assertion.
Fixes#1518.
`MGLMapboxEvents` automatically recreates its location manager when the host app is reauthorized for Location Services. Added some redundancy to ensure that there is no location manager when either Location Services or Mapbox Metrics is off.
As soon as the user returns to the host app after changing the opt-out preference in Settings, `MGLMapboxEvents` responds by pausing or resuming. Also moved the IB designables agent check to occur only once, at launch, since the process name is not expected to change mid-session.
Moved constant values from ivars into constants. Invalidate the flush timer and clear the event queue on pause. Rewrote some flush logic to be easier to follow.
The shared `MGLMapboxEvents` now owns the only instance of `MGLMetricsLocationManager`. It also owns a `MGLMapboxEventsData` object, to which all user-specific data has been relegated. This object can be built up and torn down on the fly, whenever the opt-out preference is toggled. `MGLMapboxEvents` has also given up knowledge of the access token and now queries `MGLAccountManager` for that information, which `MGLMapView` keeps up-to-date.
`-[MGLMapboxEvents init]` only gets called if `-[MGLMapboxEvents sharedManager]` sees that user defaults call for an `MGLMapboxEvents` to be created. But those user defaults were only being registered inside `-[MGLMapboxEvents init]`. This change moves the registration to `+initialize`, which is called as soon as the class is loaded.