mapbox/mapbox-ios-sdk — pull request #300 by olicarbo (2013-08-27 14:31:41+00:00)
Title: beginBackgroundCacheForTileSource : Move initializations after initial checks

Move initializations after initial checks to avoid initializing when the values (Zoom, coordinates, ...) are not correct.

This fix an issue where isBackgroundCaching always returns true even if the background caching is not running.

isBackgroundCaching checks for _activeTileSource || _backgroundFetchQueue. If the Zoom or coordinates is not correct the method will return and the background caching will not start. isBackgroundCaching will then always return true and prevent the code to try to start the background caching again. By moving the initialization after the check, if the method is called again with correct values, the background caching will be able to start normally.